Skip to content

Instantly share code, notes, and snippets.

@saadismail
Created January 24, 2017 16:21
Show Gist options
  • Save saadismail/994272facc0f2156254fb503b38ca24a to your computer and use it in GitHub Desktop.
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
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