当我进入运行Hardy 8.04的ubuntu-box时,个人.bashrc中的环境变量没有设置。 shell
若是我作一个源.bashrc,变量是正确设置的,一切都很好。 ubuntu
为何.bashrc不会在登陆时运行? bash
我有像霍布豪斯这样的状况。 我想用命令 ssh
ssh myhost.com 'some_command'
而且'some_command'存在于'/ var / some_location'中,因此我尝试经过编辑'$ HOME / .bashrc'在PATH环境中追加'/ var / some_location' spa
但那不起做用。 由于默认.bashrc(Ubuntu 10.4 LTS)阻止经过下面的代码来源 code
# If not running interactively, don't do anything [ -z "$PS1" ] && return
因此若是你想改变ssh非登陆shell的环境。 你应该在该行之上添加代码。 资源
使用SSH登陆时,不会获取.bashrc
。 您须要在.bash_profile
它,以下所示: get
if [ -f ~/.bashrc ]; then . ~/.bashrc fi
若是ayman的解决方案不起做用,请尝试命名文件.profile
而不是.bash_profile
。 这对我有用。 io
有关bash调用如何工做的优秀资源,什么dotfiles作什么,以及如何使用/配置它们,请阅读: 登录