diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2016-07-02 00:24:39 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2016-07-02 00:24:39 +1200 |
commit | ef9a12e780efdd1eb0ddcb745b9d93e312353b73 (patch) | |
tree | 52672882a2f8c89cd76ef5df0ef706e8bbb933d5 /bash/bashrc.d/pwgen.bash | |
parent | Terser pa/paz implementations (diff) | |
download | dotfiles-ef9a12e780efdd1eb0ddcb745b9d93e312353b73.tar.gz dotfiles-ef9a12e780efdd1eb0ddcb745b9d93e312353b73.zip |
Use set rather than building arg arrays
Allows for terser functions and avoids error-prone local variables; also
nicer to have a single `command` call at the end of the function
(although there are still two at the end of the ed(1) wrapper)
Diffstat (limited to 'bash/bashrc.d/pwgen.bash')
-rw-r--r-- | bash/bashrc.d/pwgen.bash | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/bash/bashrc.d/pwgen.bash b/bash/bashrc.d/pwgen.bash index f57d1884..7ba056e5 100644 --- a/bash/bashrc.d/pwgen.bash +++ b/bash/bashrc.d/pwgen.bash @@ -1,9 +1,8 @@ # Set some defaults for pwgen(1), because its defaults are to give me a long # list of relatively short passwords, when I generally want only one good one pwgen() { - if (($#)) ; then - command pwgen "$@" - else - command pwgen --secure -- "${PWGEN_LENGTH:-15}" "${PWGEN_COUNT:-1}" + if ! (($#)) ; then + set -- --secure -- "${PWGEN_LENGTH:-15}" "${PWGEN_COUNT:-1}" fi + command pwgen "$@" } |