Shell script 產生亂數密碼
使用範例 sh randpass.sh 密碼長度 密碼數量
#!/bin/bash
if [ $# -ne 2 ]; then
echo "Usage: $0 <length> <quantity>"
exit 1
filength=$1
quantity=$2for ((i=1; i<=$quantity; i++)); do
password=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c $length)
echo "Password $i: $password"
done
We're sorry. New comments are no longer being accepted.
1 person will be notified when a comment is added.
Would you like to be notified when a comment is added?
Please login or register first.