Last active
December 31, 2015 16:36
-
-
Save vvasabi/2ce892cd2fe3026f81fd to your computer and use it in GitHub Desktop.
A bash script that generates a random password and copies it to pastebook.
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 | |
LENGTH=16 | |
if [ "$#" -gt 0 ]; then | |
LENGTH="$1" | |
fi | |
# from: https://gist.github.com/earthgecko/3089509 | |
RESULT=`cat /dev/urandom \ | |
| LC_CTYPE=C tr -dc 'a-zA-Z0-9-.?~!@#$%^&*' \ | |
| head -c "$LENGTH"` | |
# comment out this line if you are not using Mac OS X | |
echo -n "$RESULT" | pbcopy | |
echo "$RESULT" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment