#=================================定义Bash提示符中显示IP==============================
if [[ `tty | grep "pts"` ]];
then
export PS1='['"\u@\033[31m`env| grep SSH_CONNECTION | awk '{print $(NF-1)}'`\033[0m"' \w]\$'
else
export PS1='[\u@\h \w]\$'
fi
#=================================定义Bash提示符中显示IP==============================
if [[ `tty | grep "pts"` ]];
then
export PS1='['"\u@\033[31m`env| grep SSH_CONNECTION | awk '{print $(NF-1)}'`\033[0m"' \w]\$'
else
export PS1='[\u@\h \w]\$'
fi
转载于:https://www.cnblogs.com/qq78292959/archive/2012/11/28/2792067.html