aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d/sudo.bash
diff options
context:
space:
mode:
Diffstat (limited to 'bash/bashrc.d/sudo.bash')
-rw-r--r--bash/bashrc.d/sudo.bash9
1 files changed, 9 insertions, 0 deletions
diff --git a/bash/bashrc.d/sudo.bash b/bash/bashrc.d/sudo.bash
new file mode 100644
index 00000000..41a97a9e
--- /dev/null
+++ b/bash/bashrc.d/sudo.bash
@@ -0,0 +1,9 @@
+# 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 "$@"
+ fi
+}
+