分页: 1 / 1

启动bash调用bash配置文件问题

发表于 : 2015-05-24 19:45
leetking
我的系统是ubuntu 14.04 LTS,终端是默认的终端软件。
现状描述:
我打开终端时,bash会读取.bashrc的内容并进行初始化。
或者在shell中以非登录启动bash时,也会读取.bashrc的内容。
目前的问题是:
在tty登录时不会读取.bashrc的内容,还有启动tmux时也不会读取.bashrc的内容(tmux的默认shell我已经设置好了)。

至此,我认为是bash的某个配置文件的问题,但是我没有能力找出来。
下面我给出我的配置文件,希望您们可以看下帮我解决下。
谢谢!!

Re: 启动bash调用bash配置文件问题

发表于 : 2015-05-24 20:09
poloshiao
我认为是bash的某个配置文件的问题
看看 這一篇 能否幫你
https://help.ubuntu.com/community/EnvironmentVariables

Re: 启动bash调用bash配置文件问题

发表于 : 2015-05-24 20:13
leetking
poloshiao 写了:
我认为是bash的某个配置文件的问题
看看 這一篇 能否幫你
https://help.ubuntu.com/community/EnvironmentVariables
谢谢,我去看看

Re: 启动bash调用bash配置文件问题

发表于 : 2015-05-24 20:22
leetking
poloshiao 写了:
我认为是bash的某个配置文件的问题
看看 這一篇 能否幫你
https://help.ubuntu.com/community/EnvironmentVariables
没有看明白如何解决我这个问题,但还是谢谢你了。

Re: 启动bash调用bash配置文件问题

发表于 : 2015-05-24 20:49
astolia
/etc/passwd里把用户的shell改成/bin/bash
用命令改也行 sudo usermod -s /bin/bash $USER

Re: 启动bash调用bash配置文件问题

发表于 : 2015-05-24 20:58
leetking
astolia 写了:/etc/passwd里把用户的shell改成/bin/bash
用命令改也行 sudo usermod -s /bin/bash $USER
您好,我的这个用户的默认shell就是bash,不用改变。
即便用了你的方法,也没有任何改变

Re: 启动bash调用bash配置文件问题

发表于 : 2015-05-24 22:02
leetking
好了,谢谢大家。这个问题我终于搞定了。
在~/.bash_profile内添加 . ~/.bashrc就好了!!
谢谢大家!!

Re: 启动bash调用bash配置文件问题

发表于 : 2015-05-24 22:02
leetking
好了,谢谢大家。这个问题我终于搞定了。
在~/.bash_profile内添加 . ~/.bashrc就好了!!
谢谢大家!!

Re: 启动bash调用bash配置文件问题

发表于 : 2015-05-24 22:03
leetking
好了,谢谢大家。这个问题我终于搞定了。
在~/.bash_profile内添加 . ~/.bashrc就好了!!
谢谢大家!!

Re: 启动bash调用bash配置文件问题

发表于 : 2015-05-24 22:46
poloshiao
目前的问题是:
在tty登录时不会读取.bashrc的内容,还有启动tmux时也不会读取.bashrc的内容(tmux的默认shell我已经设置好了)。
没有看明白如何解决我这个问题
1. https://help.ubuntu.com/community/Envir ... _variables
Suitable files for environment variable settings that should affect just a particular user (rather than the system as a whole) are ~/.pam_environment and ~/.profile.
1-1. 把你要寫的內容
寫在
~/.pam_environment

~/.profile
試試
1-2. 因為
這兩個 一定會去讀取
這是 Ubuntu 有關 環境變數 的預設

Re: 启动bash调用bash配置文件问题

发表于 : 2015-05-26 0:33
leetking
poloshiao 写了:
目前的问题是:
在tty登录时不会读取.bashrc的内容,还有启动tmux时也不会读取.bashrc的内容(tmux的默认shell我已经设置好了)。
没有看明白如何解决我这个问题
1. https://help.ubuntu.com/community/Envir ... _variables
Suitable files for environment variable settings that should affect just a particular user (rather than the system as a whole) are ~/.pam_environment and ~/.profile.
1-1. 把你要寫的內容
寫在
~/.pam_environment

~/.profile
試試
1-2. 因為
這兩個 一定會去讀取
這是 Ubuntu 有關 環境變數 的預設
谢谢,就是类似解决了的。