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

2023-02-12,,,,

[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=en
echo -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 functions alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i' # Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
bash /root/wyb/test.sh
[root@localhost wyb]# 然后在重新打开一个shell,就可以看到在test.sh设置的提示语了
Connecting to 192.168.16.110:...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'. Last login: Fri Sep :: from 192.168.16.101
hello,This is wangyuebo's shell
Fri Sep :: CST
[root@localhost ~]#

shell脚本,怎么实现每次新开一个shell都输出一个提示语?的相关教程结束。

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

下载本文的Word格式文档,以方便收藏与打印。