随机生成50个密码到指定文件中
[[email protected] ~]# 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
原文地址:http://blog.51cto.com/innocence/2152876
时间: 2024-10-10 11:36:19