aboutsummaryrefslogtreecommitdiff
path: root/sh
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2018-10-24 11:15:48 +1300
committerTom Ryder <tom@sanctum.geek.nz>2018-10-24 11:15:48 +1300
commit7454ee011907e0191ca42e63256135607a96f473 (patch)
treee8d66946d505a133658887c7f9e15d6eac95a1e4 /sh
parentMerge branch 'release/v1.70.0' into develop (diff)
downloaddotfiles-7454ee011907e0191ca42e63256135607a96f473.tar.gz
dotfiles-7454ee011907e0191ca42e63256135607a96f473.zip
Use case statement for sudo -v switching
This is slightly more idiomatic shell.
Diffstat (limited to 'sh')
-rw-r--r--sh/shrc.d/sudo.sh5
1 files changed, 4 insertions, 1 deletions
diff --git a/sh/shrc.d/sudo.sh b/sh/shrc.d/sudo.sh
index a5883168..d9e30bc4 100644
--- a/sh/shrc.d/sudo.sh
+++ b/sh/shrc.d/sudo.sh
@@ -1,5 +1,8 @@
# Add the -H parameter to sudo(8) calls, always use the target user's $HOME
sudo() {
- [ "$1" != -v ] && set -- -H "$@"
+ case $1 in
+ -v) ;;
+ *) set -- -H "$@" ;;
+ esac
command sudo "$@"
}