diff --git a/password-gen.sh b/password-gen.sh new file mode 100755 index 0000000..7dc3a85 --- /dev/null +++ b/password-gen.sh @@ -0,0 +1,23 @@ +#!/bin/sh + + +alnum() { + cat /dev/urandom | tr -dc [:alnum:] | fold -w 32 | head -1 +} + +alnum_spec() { + cat /dev/urandom | tr -dc [:alnum:]'!@#$%^&*()-_=+' | fold -w 32 | head -1 +} + +_help() { + echo 'Flags: + a - alphanumeric set + s - alphanumeric + special characters' +} + +case $1 in + a) alnum;; + s) alnum_spec;; + *) _help;; +esac +