Last active
February 22, 2017 06:11
-
-
Save david-pm/131a5926a111e65827c9784c6d290f5b to your computer and use it in GitHub Desktop.
generate a random password from cmdline
This file contains 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 | |
# | |
# 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