首页 > 代码库 > shell脚本,怎么实现每次新开一个shell都输出一个提示语?

shell脚本,怎么实现每次新开一个shell都输出一个提示语?

[root@localhost wyb]# cat test.sh echo -e "\033[32mhello,This is wangyuebo‘s shell\033[0m"echo -e "\033[32m`date`\033[0m"LANG=enecho -e "\033[32m`date` login at `hostname` `w`\033[0m" >>/etc/wangyuebo.log[root@localhost wyb]# 当写好了提示语在test.sh脚本里面,这时把脚本放到~/.bashrc文件里面就可以了 bash /root/wyb/test.sh[root@localhost wyb]# cat ~/.bashrc# .bashrc# User specific aliases and functionsalias rm=rm -ialias cp=cp -ialias mv=mv -i# Source global definitionsif [ -f /etc/bashrc ]; then    . /etc/bashrcfibash /root/wyb/test.sh[root@localhost wyb]# 然后在重新打开一个shell,就可以看到在test.sh设置的提示语了Connecting to 192.168.16.110:22...Connection established.To escape to local shell, press Ctrl+Alt+].Last login: Fri Sep  2 00:16:14 2016 from 192.168.16.101hello,This is wangyuebos shellFri Sep  2 00:19:35 CST 2016[root@localhost ~]# 

 

shell脚本,怎么实现每次新开一个shell都输出一个提示语?