Created
January 24, 2017 16:21
-
-
Save saadismail/994272facc0f2156254fb503b38ca24a to your computer and use it in GitHub Desktop.
.bashrc function to generate n numbers of random passwords consisting of x characters
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
function rpass() { | |
if [ ! -n "$1" ]; then | |
echo "Usage: rpass noofchar count" | |
return 1 | |
fi | |
if [ ! -n "$2" ]; then | |
echo "Usage: rpass noofchar count" | |
return 1 | |
fi | |
counter=0 | |
while [ $counter -lt $2 ]; do | |
openssl rand -base64 $1 | |
counter=$((counter+1)) | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment