Skip to content

Instantly share code, notes, and snippets.

@dedlim
Created June 9, 2024 11:29
Show Gist options
  • Save dedlim/79b2ac9fe3d627cd2a0dea7f9ae0f8db to your computer and use it in GitHub Desktop.
Save dedlim/79b2ac9fe3d627cd2a0dea7f9ae0f8db to your computer and use it in GitHub Desktop.
Genpass, a password generator in Bourne shell
#!/bin/sh
case "$1" in
-2) RANGE=[:alnum:]; NUM=16;;
-3) RANGE=[:digit:]; NUM=16;;
*) RANGE=[:lower:]; NUM=8;;
esac
cat /dev/urandom | tr -cd $RANGE | head -c $NUM; echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment