Refactered the password generator script.
This commit is contained in:
parent
403897b2e0
commit
6b516b3e8a
24
bin/genpw
Executable file
24
bin/genpw
Executable 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
|
|
@ -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}
|
Loading…
Reference in a new issue