有关shell的bash的启动文件相关知识。
bash的启动文件
登陆shell
非登陆shell
如下:
复制代码代码如下:
[root@localhost ~]# 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 [root@localhost ~]# echo 'export b=ok' >> .bashrc [root@localhost ~]# bash [root@localhost ~]# echo $b ok [root@localhost ~]# exit exit [root@localhost ~]# echo $b [root@localhost ~]#
执行脚本
复制代码代码如下:
[root@localhost ~]# echo 'echo $a' > 1.sh
(责任编辑:IT)[root@localhost ~]# echo $BASH_ENV [root@localhost ~]# chmod +x 1.sh [root@localhost ~]# ./1.sh [root@localhost ~]# export BASH_ENV="/root/start.sh" [root@localhost ~]# echo 'a=nihao' > /root/start.sh [root@localhost ~]# ./1.sh nihao [root@localhost ~]# |