Skip to content

Instantly share code, notes, and snippets.

@david-pm
Last active February 22, 2017 06:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save david-pm/131a5926a111e65827c9784c6d290f5b to your computer and use it in GitHub Desktop.
Save david-pm/131a5926a111e65827c9784c6d290f5b to your computer and use it in GitHub Desktop.
generate a random password from cmdline
#!/bin/bash
#
# example usage
#
# > random_password 10
if [ $# -lt 1 ]; then
echo "This command requires an integer for the password length"
else
echo -n "password: "; base64 /dev/urandom | head -c $1
fi
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment