Skip to content

Instantly share code, notes, and snippets.

@tribut
Created March 4, 2014 20:25
Show Gist options
  • Save tribut/9354889 to your computer and use it in GitHub Desktop.
Save tribut/9354889 to your computer and use it in GitHub Desktop.
#!/bin/sh
if [ -x /usr/bin/apg ]; then
if [ -z "$1" ]; then
/usr/bin/apg -m 10 -x 15 -n 1 -a 1
else
/usr/bin/apg $@
fi
elif [ -x /usr/bin/pwgen ]; then
if [ -x /usr/bin/shuf ]; then
PWLENGTH="`shuf -i 10-15 -n 1`"
else
PWLENGTH=10
fi
/usr/bin/pwgen -s -y "$PWLENGTH" 1
else
echo 'No helper for generating secure passwords found. Sorry.'
exit 1
fi
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment