shell生成随机字符串
Posted by jiayi | Posted in linux tricks | Posted on 04-10-2008
2
生成全字符随机的字串:
CODE
cat /dev/urandom | strings -n C | head -1
生成数字加字母的随机字串:
CODE
cat /dev/urandom | sed ’s/[^a-zA-Z0-9]//g’ | strings -n C | head -1
其中C表示字符串的字符数
生成全字符随机的字串:
cat /dev/urandom | strings -n C | head -1
生成数字加字母的随机字串:
cat /dev/urandom | sed ’s/[^a-zA-Z0-9]//g’ | strings -n C | head -1
其中C表示字符串的字符数