-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
31 lines (21 loc) · 890 Bytes
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
This bash function will expand functions and aliases before running sudo.
It handles all sudo arguments. There is one extra argument, -x, which
expands arguments as you, not as root. This is needed in some corner cases.
To use it, copy it to ~/.sudo.bash (for example) and put
. ~/.sudo.bash
alias sudo=sudowrap
in your .bashrc (or copy the full code into your .bashrc).
Then, simply use sudo as you would before.
You can also wrap it in a script that changes your terminal color, like so:
function setclr() {
local t=0
SetTerminalStyle $1
shift
"$@"
t=$?
SetTerminalStyle default
return $t
}
alias sudo="setclr sudo sudowrap"
For that you need SetTerminalStyle, a program that interfaces with your terminal
to set its color. (OS X only, see http://code.google.com/p/setterminalstyle/ )