配置文件
cat ~/.bashrc
Host_Address=`ip addr show eth0 | grep "inet" | grep -v "inet6" | sed 's/^.*inet //g' | sed 's#/24.*$##g'`
Name=`hostname`
user=`/usr/bin/whoami`
if [[ ${user} == "root" ]];then
export PS1="\[\033[01;31m\]\u\[\033[00m\]@\[\033[01;32m\]${Host_Address}\[\033[00m\][\[\033[01;33m\]${Name}\[\033[00m\]]:\[\033[01;34m\]\w\[\033[00m\]\n# "
else
export PS1="\[\033[01;31m\]\u\[\033[00m\]@\[\033[01;32m\]${Host_Address}\[\033[00m\][\[\033[01;33m\]${Name}\[\033[00m\]]:\[\033[01;34m\]\w\[\033[00m\]\n# "
fi
配置效果
image.png
网友评论