From ea8477198f8b82673ea68a6fc1039f258b0837c8 Mon Sep 17 00:00:00 2001 From: John D Pell Date: Thu, 23 Sep 2021 22:58:20 -0700 Subject: [PATCH] plugins/base: `passgen()` Fix `passgen()` to not need `tr`, remove one subshell, and eliminate a useless `echo`. --- plugins/available/base.plugin.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/available/base.plugin.bash b/plugins/available/base.plugin.bash index dbbac5a8..59e0fe84 100644 --- a/plugins/available/base.plugin.bash +++ b/plugins/available/base.plugin.bash @@ -62,9 +62,9 @@ function passgen() { group 'base' local -i i length=${1:-4} local pass - pass=$(echo $(for i in $(eval echo "{1..$length}"); do pickfrom /usr/share/dict/words; done)) - echo "With spaces (easier to memorize): $pass" - echo "Without spaces (easier to brute force): $(echo $pass | tr -d ' ')" + pass="$(for i in $(eval "echo {1..$length}"); do pickfrom /usr/share/dict/words; done)" + echo "With spaces (easier to memorize): ${pass//$'\n'/ }" + echo "Without spaces (easier to brute force): ${pass//$'\n'/}" } # Create alias pass to passgen when pass isn't installed or