diff --git a/bin/genpw b/bin/genpw new file mode 100755 index 0000000..38a8a4c --- /dev/null +++ b/bin/genpw @@ -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 diff --git a/bin/genpw.sh b/bin/genpw.sh deleted file mode 100755 index f443bad..0000000 --- a/bin/genpw.sh +++ /dev/null @@ -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}