diff options
-rw-r--r-- | bashrc/common/prompt.sh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/bashrc/common/prompt.sh b/bashrc/common/prompt.sh index c85f62b..f7db66e 100644 --- a/bashrc/common/prompt.sh +++ b/bashrc/common/prompt.sh @@ -7,13 +7,17 @@ export PS2="$(pcolor lblue)> $(pcolor)" export PS3="$(color lblue)#? $(color)" __make_prompt() { - local PS1UH PS1D PS1R PS1F PS1P PS1BO PS1BC rc=$? s + local PS1UH PS1D PS1R PS1F PS1P PS1BO PS1BC user host rc=$? s # username + nodename if [[ $(id -u) -eq 0 ]]; then PS1UH="$(pcolor lred)\h$(pcolor)" else - PS1UH="$(pcolor lgreen)\u@\h$(pcolor)" + [[ $USER == "alex" ]] || user="\u" + [[ $HOSTNAME == "laptop" ]] || host="\h" + [[ -n "$user" && -n "$host" ]] && user="${user}@" + [[ -z "$user" && -z "$host" ]] || host="${host} " + PS1UH="$(pcolor lgreen)${user}${host}$(pcolor)" fi # working directory @@ -96,7 +100,7 @@ __make_prompt() { s="${s} " fi - export PS1="${PS1UH} ${PS1BO}${PS1R}${PS1F}${PS1BC} ${PS1D} ${s}${PS1P}" + export PS1="${PS1UH}${PS1D} ${PS1BO}${PS1R}${PS1F}${PS1BC} ${s}${PS1P}" if [[ "${TERM#screen}" != "${TERM}" ]]; then _hostname=$(hostname) |