aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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