aboutsummaryrefslogtreecommitdiffstats
path: root/bash/.bashrc
diff options
context:
space:
mode:
authorGravatar Tom van der Lee <t0m.vd.l33@gmail.com>2015-08-25 13:43:50 +0200
committerGravatar Tom van der Lee <t0m.vd.l33@gmail.com>2015-08-25 13:43:50 +0200
commitef52a18605b17a67eeed0a5772fb60d6d0106899 (patch)
tree09efce6f441666d71c77e6387fdb94fab66b71d1 /bash/.bashrc
parent8b225133c9d7da23ce32e222858ed0fa6051d98d (diff)
downloaddotfiles-ef52a18605b17a67eeed0a5772fb60d6d0106899.tar.gz
dotfiles-ef52a18605b17a67eeed0a5772fb60d6d0106899.tar.bz2
dotfiles-ef52a18605b17a67eeed0a5772fb60d6d0106899.zip
Removed sudo function
Diffstat (limited to 'bash/.bashrc')
-rwxr-xr-xbash/.bashrc28
1 files changed, 0 insertions, 28 deletions
diff --git a/bash/.bashrc b/bash/.bashrc
index c71c184..247955a 100755
--- a/bash/.bashrc
+++ b/bash/.bashrc
@@ -67,34 +67,6 @@ is_alias() {
67 fi 67 fi
68} 68}
69 69
70# Execute functions and aliasses with sudo
71if exists sudo; then
72 sudo() {
73 # Allow functions and aliasses to be executed with sudo
74 if is_function $1 2> /dev/null; then
75 tmpfile="/tmp/$(date +%s).sh"
76
77 echo "#!$usr/bin/bash" > "$tmpfile"
78 echo "usr=$usr" >> "$tmpfile"
79 type $1 | grep -v "is a function" >> "$tmpfile"
80 echo "$@" >> "$tmpfile"
81
82 chmod +x "$tmpfile"
83
84 $usr/bin/sudo "$tmpfile"
85
86 rm "$tmpfile"
87 elif is_alias $1 2> /dev/null; then
88 alias=$(type $1 2> /dev/null |
89 sed -n "s/^$1\ is\ aliased\ to\ \`\(.*\)'$/\1/p")
90
91 $usr/bin/sudo "$alias"
92 else
93 $usr/bin/sudo "$@"
94 fi
95 }
96fi
97
98# Set autocomplete for sudo 70# Set autocomplete for sudo
99if exists complete && exists sudo; then 71if exists complete && exists sudo; then
100 complete -cf sudo 72 complete -cf sudo