From 3f438dda55311a0e6b0c561f48ba05cb736802db Mon Sep 17 00:00:00 2001 From: tapesonthefloor Date: Thu, 19 Mar 2015 09:52:41 -0400 Subject: [PATCH] Accepts a length parameter. Changed regex from exclusive to inclusive. --- passphrase | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/passphrase b/passphrase index 328088d..60a71c1 100755 --- a/passphrase +++ b/passphrase @@ -1,14 +1,14 @@ -!/bin/bash +#!/bin/bash # Generates random phrases appropriate for memorable but secure passwords. # Picks three words of intermediate length from local dictionary file. # Displays multiple sets. -for z in {1..5}; do +for (( z = 1; z <= ${1:-1}; z++ )) do # Check for a length parameter. Default to 1. for i in {1..5}; do - echo $(grep "^[^'A-Z]\{3,8\}$" /usr/share/dict/words|shuf -n3) + echo $( grep "^[a-z]\{3,8\}$" /usr/share/dict/words | shuf -n3 ) done