2015-03-26 18:25:58 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
ECHOARGS=
|
|
|
|
LENGTH=12
|
|
|
|
|
|
|
|
while getopts nl: ARG; do
|
|
|
|
case ${ARG} in
|
|
|
|
n) ECHOARGS="-n"
|
|
|
|
;;
|
|
|
|
|
|
|
|
l) LENGTH=${OPTARG}
|
|
|
|
;;
|
|
|
|
|
2015-05-18 19:52:02 +01:00
|
|
|
?) printf "Usage: %s [-n] [-l X]\n" ${0}
|
2015-03-26 18:25:58 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2015-06-15 20:35:11 +01:00
|
|
|
PW=$(openssl rand -base64 ${LENGTH} | cut -c1-${LENGTH})
|
2015-03-26 18:25:58 +00:00
|
|
|
|
|
|
|
echo ${ECHOARGS} ${PW}
|
|
|
|
|
|
|
|
exit 0
|