Created
January 6, 2019 15:45
-
-
Save rnelson/5e53f6a11777559faa4c297d18c56103 to your computer and use it in GitHub Desktop.
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/ksh | |
# Cobbled together using https://www.romanzolotarev.com/random.html | |
# and https://docstore.mik.ua/orelly/unix3/korn/appb_11.htm | |
CHARS=' -~' | |
SIZE=20 | |
USAGE="as#" | |
while getopts "$USAGE" opt; do | |
case $opt in | |
a) CHARS='[:alnum:]' ;; | |
s) SIZE=$OPTARG | |
esac | |
done | |
tr -cd "$CHARS" < /dev/urandom | fold -w $SIZE | head -n 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment