Created
September 21, 2016 02:17
-
-
Save staugur/326ca75dcfb2f044a13162f7d1c7f380 to your computer and use it in GitHub Desktop.
生成复杂随机密码,复杂度可以自己修改,默认生成15个字符,可以带一个数字参数,指定生成的长度。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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