summaryrefslogtreecommitdiffstats
path: root/bashrc/common
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-01-10 01:32:15 +0100
committerAlexander Sulfrian <alexander@sulfrian.net>2012-01-10 01:32:15 +0100
commit376cc082e5866538886aa7efc03a1fcfe13672fd (patch)
tree09fe428dfc79a69b560abbd66b514685f17713c8 /bashrc/common
parent5320c2bb29d8044a9b96ce0776838e76823f8158 (diff)
downloaddotfiles-376cc082e5866538886aa7efc03a1fcfe13672fd.tar.gz
dotfiles-376cc082e5866538886aa7efc03a1fcfe13672fd.tar.xz
dotfiles-376cc082e5866538886aa7efc03a1fcfe13672fd.zip
common/prompt: hide user if alex, hide host if laptop
Diffstat (limited to '')
-rw-r--r--bashrc/common/prompt.sh10
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)