Refactered the password generator script.

This commit is contained in:
Scott Wallace 2015-03-26 18:25:58 +00:00
parent 403897b2e0
commit 6b516b3e8a
2 changed files with 24 additions and 8 deletions

24
bin/genpw Executable file
View file

@ -0,0 +1,24 @@
#!/bin/bash
ECHOARGS=
LENGTH=12
while getopts nl: ARG; do
case ${ARG} in
n) ECHOARGS="-n"
;;
l) LENGTH=${OPTARG}
;;
?) printf "Usage: %s [-n]\n" ${0}
exit 1
;;
esac
done
PW=$(jot -rc 256 48 123 | grep -m${LENGTH} "\w" | rs -g 0 ${LENGTH})
echo ${ECHOARGS} ${PW}
exit 0

View file

@ -1,8 +0,0 @@
#!/bin/bash
LENGTH=12
[ ${1} ] && LENGTH=${1}
PW=$(jot -rc 256 48 123 | grep -m${LENGTH} "\w" | rs -g 0 ${LENGTH})
echo -n ${PW}