STAGE=dev
LABEL=bastion
#force_color_prompt=yes
force_color_prompt=yes
if [ "$color_prompt" = yes ]; then
# 修改前
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# 修改後
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]@\[\033[01;30m\]\[\033[43m\]$STAGE\[\033[00m\]-\[\033[01;31m\]$LABEL\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
# 修改前
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
# 修改後
PS1='${debian_chroot:+($debian_chroot)}\u@$STAGE-$LABEL:\w\$ '
fi
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
# 修改前
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
# 修改後,這邊的修改會影響PuTTY視窗的「標題」
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@$STAGE-$LABEL \h: \w\a\]$PS1"
;;
*)
;;
esac
各種顏色組合參考
. .bashrc
~/.ssh/config
Host private-host-1
HostName 172.31.48.199
Host private-host-2
HostName 172.31.48.182
Host private-host-3
HostName 172.31.48.213
設定好後,用指令ssh private....
(按Tab會協助完成名字)
ubuntu@dev-bastion:~/.ssh$ ssh private-host-
private-host-1 private-host-2 private-host-3
這樣是不是很清楚,就不會搞不清楚是「哪個環境」「哪台機器」了…@@
待續…