Created
February 2, 2018 07:44
-
-
Save akash0x53/f69e69939804d13cb13a627fc5d28b30 to your computer and use it in GitHub Desktop.
Generate random password
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
genpass() | |
{ | |
#usage: genpass some-random-website.com 12 | |
#generate random password for some-random-website.com and saves in ~/.pass | |
FOR=$1 | |
LEN=$2 | |
shift | |
if [ "$LEN" == "" ];then | |
LEN=8 | |
fi | |
paswd=$(head -c200 /dev/urandom |tr -cd [:alnum:]+[\!\@\#\$]|head -c $LEN) | |
echo "$paswd"|xclip -selection c | |
echo "Copied to clipboard" | |
if [ "$FOR" == "" ];then | |
FOR=$(date) | |
fi | |
echo "${FOR}: $paswd" >> ~/.pass | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment