prompt user vs root
This commit is contained in:
parent
f3b19befc2
commit
a735c0d758
35
_bashrc
35
_bashrc
@ -39,19 +39,6 @@ WHITE='\[\033[0;37m\]'
|
|||||||
WHITEB='\[\033[1;37m\]'
|
WHITEB='\[\033[1;37m\]'
|
||||||
RESET='\[\033[0;00m\]'
|
RESET='\[\033[0;00m\]'
|
||||||
|
|
||||||
##### FUNCTIONS #####
|
|
||||||
|
|
||||||
# status indicator
|
|
||||||
prompt_status()
|
|
||||||
{
|
|
||||||
if [[ "$?" == "0" ]]
|
|
||||||
then
|
|
||||||
echo -n "${GREENB}-"
|
|
||||||
else
|
|
||||||
echo -n "${REDB}X"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
##### INCLUDES #####
|
##### INCLUDES #####
|
||||||
|
|
||||||
# Alias definitions.
|
# Alias definitions.
|
||||||
@ -98,6 +85,26 @@ export SSH_AUTH_SOCK=~/.ssh/ssh_auth_sock
|
|||||||
|
|
||||||
##### PROMPT #####
|
##### PROMPT #####
|
||||||
|
|
||||||
|
# status indicator
|
||||||
|
prompt_status()
|
||||||
|
{
|
||||||
|
if [[ "$?" == "0" ]]
|
||||||
|
then
|
||||||
|
echo -n "${GREENB}-"
|
||||||
|
else
|
||||||
|
echo -n "${REDB}X"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
prompt_root()
|
||||||
|
{
|
||||||
|
if [[ "$(id -u)" == "0" ]]
|
||||||
|
then
|
||||||
|
echo -n "${REDB}#"
|
||||||
|
else
|
||||||
|
echo -n "${WHITEB}$"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
__ps1()
|
__ps1()
|
||||||
{
|
{
|
||||||
ps1pre="$1"
|
ps1pre="$1"
|
||||||
@ -105,7 +112,7 @@ __ps1()
|
|||||||
PS1="$ps1pre$ps1post"
|
PS1="$ps1pre$ps1post"
|
||||||
}
|
}
|
||||||
PS1pre='"${REDB}>> ${WHITEB}(${WHITE}\u@${GREEN}\h${WHITEB}) ${BLUEB}\w${RESET}"'
|
PS1pre='"${REDB}>> ${WHITEB}(${WHITE}\u@${GREEN}\h${WHITEB}) ${BLUEB}\w${RESET}"'
|
||||||
PS1post='"\n$(prompt_status)${REDB}>${WHITE} "'
|
PS1post='"\n$(prompt_status)$(prompt_root)${RESET} "'
|
||||||
PROMPT_COMMAND="__ps1 $PS1pre $PS1post"
|
PROMPT_COMMAND="__ps1 $PS1pre $PS1post"
|
||||||
|
|
||||||
##### GIT #####
|
##### GIT #####
|
||||||
|
Loading…
Reference in New Issue
Block a user