利用 /dev/urando 生成密码
# 密码以字母、数字、开头 # 特殊符号多 for _ in {1..30};do tr -dc '~`!@#$%^&*()_+-={}:"<>?[];,./A-Za-z0-9"'"'" </dev/urandom |head -c 25;echo ;done |grep ^[a-zA-Z0-9] echo # 特殊符号少 for _ in {1..30};do tr -dc '(!@&%^-_=+[{}]:,./?~#*)A-Za-z0-9' </dev/urandom |head -c 25;echo ;done |grep -P "^[a-zA-Z0-9](?=.*[0-9])(?=.*[a-z])(?=.*[A-Z])(?=.*[!@&%^-_=+[{}]:,./?~#*]).{20,30}$"