[
root@localhost root]# cat .bash_profile
#!/bin/sh
#!/bin/sh
if [ -f ${HOME}/.bashrc ]
//如果当前目录存在.bashrc -f表示文件
then
. ${HOME}/.bashrc //就执行.bashrc
fi //结束,与前一个if对应。
then
. ${HOME}/.bashrc //就执行.bashrc
fi //结束,与前一个if对应。
if [ -d ${HOME}/modules ]
//如果当前目录存在modules目录,-d表示目录
then
cd ${HOME}/modules //进入modules目录
if [ -f ${HOME}/modules/load_modules.sh ] //如果存在load_modules.sh
then
. ${HOME}/modules/load_modules.sh //则执行
cd ${HOME} //切换目录
./main_sdk7105_7105_ST40_LINUX_32BITS.out //执行
fi
# if [ -f ${HOME}/modules/staudlx_aic3104.ko ]
# then
# /sbin/insmod ${HOME}/modules/staudlx_aic3104.ko
# fi
fi
[root@localhost root]#
then
cd ${HOME}/modules //进入modules目录
if [ -f ${HOME}/modules/load_modules.sh ] //如果存在load_modules.sh
then
. ${HOME}/modules/load_modules.sh //则执行
cd ${HOME} //切换目录
./main_sdk7105_7105_ST40_LINUX_32BITS.out //执行
fi
# if [ -f ${HOME}/modules/staudlx_aic3104.ko ]
# then
# /sbin/insmod ${HOME}/modules/staudlx_aic3104.ko
# fi
fi
[root@localhost root]#
${HOME} :表示当前目录
这里面有意思的就是 if then fi语句的应用~ 只要root登陆进来,脚本就会自动运行。非常方便,可以极大提高调试效率。
[root@localhost root]# cat .bashrc
# root .bashrc file
DISPLAY=:0
export PATH DISPLAY
alias ls="ls -F --color=auto"
ulimit -c 0
[root@localhost root]#
# root .bashrc file
DISPLAY=:0
export PATH DISPLAY
alias ls="ls -F --color=auto"
ulimit -c 0
[root@localhost root]#
经常编辑vim的时候会用到.bashrc。