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

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

[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

</dev/urandom tr -dc 'a-zA-Z0-9!@#$%^&*()_+' | head -c 15
相關文章
相關標籤/搜索