LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1370|回复: 6

为何设为局部的alias在console下失效?(已解决)

[复制链接]
发表于 2007-11-2 00:15:26 | 显示全部楼层 |阅读模式
这三个必不可少:
alias cp='cp -i'
alias mv='mv -i'
alias rm='rm -i'
我在~/.bashrc中设为局部的alias,在Xwindows中没问题,但是在console下找不到这三个alias,请问这是为什么呢?从理论上来说应该是可以的呀,  难道非要设为全局的才行吗?
发表于 2007-11-2 01:49:13 | 显示全部楼层
.bash_profile, 里边有没有这个:
# /etc/skel/.bash_profile

# This file is sourced by bash for login shells.  The following line
# runs your .bashrc and is recommended by the bash info pages.
[[ -f ~/.bashrc ]] && . ~/.bashrc
回复 支持 反对

使用道具 举报

发表于 2007-11-2 08:46:24 | 显示全部楼层
Post by blackwhite
.bash_profile, 里边有没有这个:
# /etc/skel/.bash_profile

# This file is sourced by bash for login shells.  The following line
# runs your .bashrc and is recommended by the bash info pages.
[[ -f ~/.bashrc ]] && . ~/.bashrc



.bashrc和.bash_profile之间有什么关系????????
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-11-2 10:50:55 | 显示全部楼层
Post by blackwhite
.bash_profile, 里边有没有这个:
# /etc/skel/.bash_profile

# This file is sourced by bash for login shells.  The following line
# runs your .bashrc and is recommended by the bash info pages.
[[ -f ~/.bashrc ]] && . ~/.bashrc


有,
# ls /etc/skel
.  ..  .bash_logout  .bash_profile  .bashrc

但手册上关于环境变量一节中,并没有提到这个文件夹,不知它作什么用。
回复 支持 反对

使用道具 举报

发表于 2007-11-2 11:22:18 | 显示全部楼层
Post by mascot
有,
# ls /etc/skel
.  ..  .bash_logout  .bash_profile  .bashrc

但手册上关于环境变量一节中,并没有提到这个文件夹,不知它作什么用。



/etc/skel 存放着预设的 .bash_logout   .bash_profile   .bashrc等文件,当你创建一个新用户时,会自动从/etc/skel里复制到新用户的主目录下。
回复 支持 反对

使用道具 举报

发表于 2007-11-2 12:46:48 | 显示全部楼层
shell分两种
login shell和非login shell
字符界面登录进去的是login shell
X里启动的是非login shell
su的是非login shell
su -的是login shell
login shell会读取/etc/profile ~/.bash_profile
非login shell读取~/.bashrc
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-11-2 13:21:18 | 显示全部楼层
Post by 狱卒
/etc/skel 存放着预设的 .bash_logout   .bash_profile   .bashrc等文件,当你创建一个新用户时,会自动从/etc/skel里复制到新用户的主目录下。
这个skel方式应该是Gentoo特有的了。我习惯直接使用root,不过我的/root目录下没有这三个文件,.bashrc文件是我手工的。
补充:我知道为什么我的/root目录下没这三个文件,可能是我作系统的时候作得不完整,当时root的密码忘了设置,从其它的系统的/etc/shadow中把密码拷贝过去才进入了Gentoo。
Post by zhllg
shell分两种
login shell和非login shell
字符界面登录进去的是login shell
X里启动的是非login shell
su的是非login shell
su -的是login shell
login shell会读取/etc/profile ~/.bash_profile
非login shell读取~/.bashrc

太有哲理了,呵呵
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表