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/sudo.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/sudo.bash')
-rw-r--r-- | bash/bashrc.d/sudo.bash | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/bash/bashrc.d/sudo.bash b/bash/bashrc.d/sudo.bash index 5bb8906a..d6d91d12 100644 --- a/bash/bashrc.d/sudo.bash +++ b/bash/bashrc.d/sudo.bash @@ -1,8 +1,7 @@ # Add the -H parameter to sudo(8) calls, always use the target user's $HOME sudo() { - if [[ $1 == -v ]] ; then - command sudo "$@" - else - command sudo -H "$@" + if [[ $1 != -v ]] ; then + set -- -H "$@" fi + command sudo "$@" } |