码迷,mamicode.com
首页 > 系统相关 > 详细

linux添加自定义的命令!

时间:2015-08-08 19:48:59      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:

 

修改了/root/下的.bashrc

-bash-4.1# vi .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


if [ -f ~/bash_aliases ]; then
. ~/bash_aliases
elif [ -f bash_aliases ]; then
. bash_aliases
else
echo " no bash_aliases found !"
fi

~

 

/etc/下的 bashrc 

文末尾增加


if [ -f bash_aliases ]; then
    . /etc/bash_aliases;
   echo " 1111111 aasb";
fi    
 

 

或者修改/etc/profile,

 

执行 .  bashrc 或 . .bashrc 或通过source执行(会有echo信息), 只能在当前shell生效, 新开的shell就不行(没有echo信息)!reboot 重启都不行!

 

———— 可能是因为我修改了/root 根目录的缘故吧。。。

 

后面在 /etc/profile.d/ 增加一个sh脚本, 就可以了!,每次新开shell窗口都会有echo !

 

参考

http://blog.csdn.net/chenchong08/article/details/7833242 —— 这里其实说的不准确,当修改了/root 根目录

 

linux添加自定义的命令!

标签:

原文地址:http://www.cnblogs.com/FlyAway2013/p/4713670.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!