Skip to content

Instantly share code, notes, and snippets.

@staugur
Created September 21, 2016 02:17
Show Gist options
  • Save staugur/326ca75dcfb2f044a13162f7d1c7f380 to your computer and use it in GitHub Desktop.
Save staugur/326ca75dcfb2f044a13162f7d1c7f380 to your computer and use it in GitHub Desktop.
生成复杂随机密码,复杂度可以自己修改,默认生成15个字符,可以带一个数字参数,指定生成的长度。
#!/bin/bash
#生成复杂随机密码
L=12
if [ ! -z $1 ];then
if [[ "$1" =~ ^[0-9]+$ ]];then
L=$1
fi
fi
</dev/urandom tr -dc '1234567890!@#%$qwertQWERTasdfgASDFGzxcvbZXCVBCdgFsY_lMt' | head -c${L}; echo ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment