aboutsummaryrefslogtreecommitdiff
path: root/bash/bashrc.d
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2014-03-12 16:48:59 +1300
committerTom Ryder <tom@sanctum.geek.nz>2014-03-12 16:48:59 +1300
commit4d930a550815d7da54dba2950527f3dba8d7f9f7 (patch)
tree52266f6913805f760fde4c3d94ed3aed1073fb7d /bash/bashrc.d
parentFix stray comment (diff)
downloaddotfiles-4d930a550815d7da54dba2950527f3dba8d7f9f7.tar.gz
dotfiles-4d930a550815d7da54dba2950527f3dba8d7f9f7.zip
Don't force -H for sudo if -v
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r--bash/bashrc.d/aliases.bash3
-rw-r--r--bash/bashrc.d/sudo.bash9
2 files changed, 9 insertions, 3 deletions
diff --git a/bash/bashrc.d/aliases.bash b/bash/bashrc.d/aliases.bash
index 2e68491c..709f8088 100644
--- a/bash/bashrc.d/aliases.bash
+++ b/bash/bashrc.d/aliases.bash
@@ -13,6 +13,3 @@ alias gdb='gdb -q'
# Use a unified format for rcsdiff(1) by default
alias rcsdiff='rcsdiff -u'
-# sudo(8) should always attempt to use the target user's $HOME
-alias sudo='sudo -H'
-
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
+}
+