1. 程式人生 > >隨機生成50個密碼到指定文件中

隨機生成50個密碼到指定文件中

ash code rand tro amp txt -c cal \n

隨機生成50個密碼到指定文件中

[root@local-centos7 ~]# cat round.sh 
#!/bin/bash
count=1
while [ $count -le 50 ]
do
    round=`cat /dev/urandom | head -n 10 | md5sum | head -c 8` 
    echo $round >> /root/round.txt
    let count++
done

或者也可以這樣來寫
for((i=1;i<=50;i++)); do head -n 10  /dev/urandom| md5sum | head -c 8|sed -nr ‘s#.*#&\n#pg‘|tee -a file &>/dev/null ; done

隨機生成50個密碼到指定文件中