Skip to content

Instantly share code, notes, and snippets.

@frntn
Created August 2, 2017 22:57
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 frntn/704e789e55e53ad2cc1925272e0ea989 to your computer and use it in GitHub Desktop.
Save frntn/704e789e55e53ad2cc1925272e0ea989 to your computer and use it in GitHub Desktop.
GenPass function to your bashrc
# add this to your .bashrc
function genpass {
isint='^[1-9][0-9]*$'
[[ $1 =~ $isint ]] && count=$1 || count=1
[[ $2 =~ $isint ]] && len=$2 || len=10
for i in $(seq 1 $count); do </dev/urandom tr -dc A-Za-z0-9 | head -c$len ; echo ; done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment