linux系统定制开发
前言
自定义linux串口终端显示的名称。
一、PS1命令编写
在命令行输入
export PS1="[\e[1;36m][\u@\h \W]\$[\e[0m]"
就可以看到预览效果
预览效果:[root@TinaLinux /etc]#
二、具体应用步骤
1.profile 启动
代码如下(示例):通过系统profile 文件启动脚本执行export PS1="[\e[1;36m][\u@\h \W]\$[\e[0m]" 命令
添加下面的代码到etc/profile文件中
# Source configuration files from /etc/profile.d
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
user.sh脚本如下,把user.sh脚本放到/etc/profile.d目录下
#!/bin/sh
export PS1="[\e[1;36m][\u@\h \W]\$[\e[0m]"
重启linux系统后,系统就会自动执行export PS1="[\e[1;36m][\u@\h \W]\$[\e[0m]"命令