plugins/base: `passgen()`

Fix `passgen()` to not need `tr`, remove one subshell, and eliminate a useless `echo`.
pull/1930/head
John D Pell 2021-09-23 22:58:20 -07:00
parent c8ed9a9da8
commit ea8477198f
1 changed files with 3 additions and 3 deletions

View File

@ -62,9 +62,9 @@ function passgen() {
group 'base' group 'base'
local -i i length=${1:-4} local -i i length=${1:-4}
local pass local pass
pass=$(echo $(for i in $(eval echo "{1..$length}"); do pickfrom /usr/share/dict/words; done)) pass="$(for i in $(eval "echo {1..$length}"); do pickfrom /usr/share/dict/words; done)"
echo "With spaces (easier to memorize): $pass" echo "With spaces (easier to memorize): ${pass//$'\n'/ }"
echo "Without spaces (easier to brute force): $(echo $pass | tr -d ' ')" echo "Without spaces (easier to brute force): ${pass//$'\n'/}"
} }
# Create alias pass to passgen when pass isn't installed or # Create alias pass to passgen when pass isn't installed or