aboutsummaryrefslogtreecommitdiffstats
path: root/bin/pword.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/pword.sh')
-rwxr-xr-xbin/pword.sh7
1 files changed, 7 insertions, 0 deletions
diff --git a/bin/pword.sh b/bin/pword.sh
new file mode 100755
index 0000000..36b70dd
--- /dev/null
+++ b/bin/pword.sh
@@ -0,0 +1,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}"