Skip to content

Instantly share code, notes, and snippets.

@bmritz
Created July 26, 2024 17:28
Show Gist options
  • Save bmritz/6a5387fdd64b8b5255495cd51da7d7c6 to your computer and use it in GitHub Desktop.
Save bmritz/6a5387fdd64b8b5255495cd51da7d7c6 to your computer and use it in GitHub Desktop.
generate_passphrase.sh
#!/bin/bash
# Default number of words
NUM_WORDS=${1:-4}
# Generate a passphrase with a variable number of easily understood words separated by hyphens
shuf -n "$NUM_WORDS" /usr/share/dict/words | tr '\n' '-' | sed 's/-$//' | sed 's/$/\n/'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment