diff options
Diffstat (limited to 'bashrc/common')
-rw-r--r-- | bashrc/common/prompt.sh | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/bashrc/common/prompt.sh b/bashrc/common/prompt.sh index fe2a139..cc57e38 100644 --- a/bashrc/common/prompt.sh +++ b/bashrc/common/prompt.sh @@ -7,22 +7,22 @@ export PS2="$(pcolor lblue)> $(pcolor)" export PS3="$(color lblue)#? $(color)" __make_prompt() { - local PS1UH PS1D PS1R PS1F PS1P PS1BO PS1BC PS1VE user host rc=$? s + local PS1UH PS1D PS1R PS1F PS1P PS1BO PS1BC PS1VE user host _hostname rc=$? s + _hostname=$(hostname) # username + nodename - [[ $USER == "alex" ]] || user="\u" - [[ $HOSTNAME == "laptop" ]] || host="\h" - [[ -n "$user" && -n "$host" ]] && user="${user}@" + [[ $(id -nu) == "alex" ]] || user="\u" + [[ "${_hostname}" == "laptop" ]] || host="@${_hostname}" [[ -z "$user" && -z "$host" ]] || host="${host} " if [[ $(id -u) -eq 0 ]]; then PS1UH="$(pcolor lred)${user}${host}$(pcolor)" else - PS1UH="$(pcolor lgreen)${user}${host}$(pcolor)" + PS1UH="$(pcolor lcyan)${user}${host}$(pcolor)" fi # working directory - PS1D="$(pcolor lblue)$(pwd -P)$(pcolor)" + PS1D="$(pcolor lpurple)$(pwd -P)$(pcolor)" # return code if [[ $rc -eq 0 ]]; then @@ -107,7 +107,6 @@ __make_prompt() { export PS1="${PS1VE}${PS1UH}${PS1D} ${PS1BO}${PS1R}${PS1F}${PS1BC} ${s}${PS1P}" if [[ "${TERM#screen}" != "${TERM}" ]]; then - _hostname=$(hostname) echo -ne "\ek$(id -un)@${_hostname%%\.*}\e\\" fi } |