root/下的.bashrc_.bash_profile使用

[ root@localhost root]# cat .bash_profile
#!/bin/sh
if [ -f ${HOME}/.bashrc ] //如果当前目录存在.bashrc   -f表示文件
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]#
 
${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]#

经常编辑vim的时候会用到.bashrc。
 
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值