Abuse uptime to check if sudo requires password

The ``sudo -n true`` trick doesn't work on OS X.
This commit is contained in:
jitakirin
2015-05-22 08:43:34 +01:00
parent 9693b39da6
commit 473b3f2075

View File

@@ -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