#!/bin/bash
# Modify showed marked
#
# biaoshi.sh 207
# by Wangxianzheng 2011/12/20
path=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/ X11r6/bin:/root/bin
echo "####### #execute $ begin...##############"
sysver=$ (head-n 1/etc/issue |awk ' {print $} ')
function MODIFY_BASHRC () {
echo "dst=$ (netcard=$ (ifconfig |grep-b1 192.168 |awk '/eth/{if ($1==" eth1 ") print" eth1 "; else print" eth0 "} ' |head-1) ; Ifconfig |awk ' {if (a) {split ($0,b, "addr:| Bcast: ");p rint b[2]}; a=0}/'" $NETCARD "'/{a=1} ' |head-1)"
Sed-i-E "/ps1/s#ps1=\" \[.*\\\.*\] #PS1 =\ "\\\[\\\e\[1;32m\\\]\[\\\u\@\\\[\\\e\[m\\\]\\\[\\\e\[1;36m\\\]\$\ ( Netcard=\$\ (ifconfig \|grep-b1 192.168 \|awk \ '/eth/\{if \ (\$1==\ "eth1\" \) print \ "eth1\" \; else print \ "eth0\" \}\ ' \|he ad-1\) \;ifconfig \|awk \ ' \{if\ (a\) \{split\ (\$0\,b\,\ "addr\:\| Bcast\:\ ") \;p rint b\[2\]\} \;a=0\}/\ ' \" \ $NETCARD \ "\ '/\{a=1\}\ ' \|head-1\) \\\[\\\e\[m\\\]\\\[\\\e\[1;32m\\\] \\\w\] \\\[\\\e\[m\\\]# "/ETC/BASHRC
Sed-i "s/prompt_command= ' echo/prompt_command= '; # ' echo/'/ETC/BASHRC
}
Case $SYSVER in
4.6)
echo "The current system VER $SYSVER"
Modify_bashrc
;;
5.4)
echo "The current system VER $SYSVER"
Modify_bashrc
;;
*)
echo "The current system don ' t know $SYSVER"
Modify_bashrc
;;
Esac
echo "####### #execute $ end...##############"
A shell script that gives your Linux command line a cool look