Abuse uptime to check if sudo requires password
The ``sudo -n true`` trick doesn't work on OS X.pull/484/head
parent
9693b39da6
commit
473b3f2075
|
|
@ -38,7 +38,7 @@ function set_rgb_color {
|
|||
|
||||
function powerline_shell_prompt {
|
||||
SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR}
|
||||
if sudo -n true &>/dev/null; then
|
||||
if sudo -n uptime 2>&1 |grep -q "load"; then
|
||||
SHELL_PROMPT_COLOR=${SHELL_THEME_PROMPT_COLOR_SUDO}
|
||||
fi
|
||||
if [[ -n "${SSH_CLIENT}" ]]; then
|
||||
|
|
|
|||
Loading…
Reference in New Issue