aboutsummaryrefslogtreecommitdiffstats
path: root/bin/pword.sh
blob: 36b70dd001dd7e5698286a6939c373d08d7b86e4 (plain)
1
2
3
4
5
6
7
#!/bin/sh
# inspired by https://www.unix-ninja.com/p/A_cheat-sheet_for_password_crackers

# usage: pw [length [characters]]
tr -dc "${2:-'a-zA-Z0-9._!@#$%^&*()'}" < /dev/urandom \
  | fold -w "${1:-17}" \
  | head -n "${3:-1}"