Skip to content

Instantly share code, notes, and snippets.

@mikhdm
Last active December 23, 2021 18:13
Show Gist options
  • Save mikhdm/6e887b4e273895af4d917b3e214efb1e to your computer and use it in GitHub Desktop.
Save mikhdm/6e887b4e273895af4d917b3e214efb1e to your computer and use it in GitHub Desktop.
password generator
#!/bin/bash
PATTERN="A-Za-z0-9_"
if [ -z "$1" ]; then
N=16
else
N=$1
fi
echo $(cat /dev/urandom | LC_ALL=C tr -cd "$PATTERN" | head -c $N)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment