From ef9a12e780efdd1eb0ddcb745b9d93e312353b73 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Sat, 2 Jul 2016 00:24:39 +1200 Subject: 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) --- bash/bashrc.d/sudo.bash | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'bash/bashrc.d/sudo.bash') 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 "$@" } -- cgit v1.2.3