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

sh/bash/dash/ksh/zsh等Shell脚本
回复
leetking
帖子: 62
注册时间: 2014-10-28 14:53
系统: ubuntu-18.04-LTS

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

#1

帖子 leetking » 2015-05-24 19:45

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

至此,我认为是bash的某个配置文件的问题,但是我没有能力找出来。
下面我给出我的配置文件,希望您们可以看下帮我解决下。
谢谢!!
附件
bash.tar.zip
相应的配置文件
(4.99 KiB) 已下载 110 次
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

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

#2

帖子 poloshiao » 2015-05-24 20:09

我认为是bash的某个配置文件的问题
看看 這一篇 能否幫你
https://help.ubuntu.com/community/EnvironmentVariables
leetking
帖子: 62
注册时间: 2014-10-28 14:53
系统: ubuntu-18.04-LTS

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

#3

帖子 leetking » 2015-05-24 20:13

poloshiao 写了:
我认为是bash的某个配置文件的问题
看看 這一篇 能否幫你
https://help.ubuntu.com/community/EnvironmentVariables
谢谢,我去看看
leetking
帖子: 62
注册时间: 2014-10-28 14:53
系统: ubuntu-18.04-LTS

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

#4

帖子 leetking » 2015-05-24 20:22

poloshiao 写了:
我认为是bash的某个配置文件的问题
看看 這一篇 能否幫你
https://help.ubuntu.com/community/EnvironmentVariables
没有看明白如何解决我这个问题,但还是谢谢你了。
头像
astolia
论坛版主
帖子: 6444
注册时间: 2008-09-18 13:11

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

#5

帖子 astolia » 2015-05-24 20:49

/etc/passwd里把用户的shell改成/bin/bash
用命令改也行 sudo usermod -s /bin/bash $USER
leetking
帖子: 62
注册时间: 2014-10-28 14:53
系统: ubuntu-18.04-LTS

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

#6

帖子 leetking » 2015-05-24 20:58

astolia 写了:/etc/passwd里把用户的shell改成/bin/bash
用命令改也行 sudo usermod -s /bin/bash $USER
您好,我的这个用户的默认shell就是bash,不用改变。
即便用了你的方法,也没有任何改变
leetking
帖子: 62
注册时间: 2014-10-28 14:53
系统: ubuntu-18.04-LTS

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

#7

帖子 leetking » 2015-05-24 22:02

好了,谢谢大家。这个问题我终于搞定了。
在~/.bash_profile内添加 . ~/.bashrc就好了!!
谢谢大家!!
leetking
帖子: 62
注册时间: 2014-10-28 14:53
系统: ubuntu-18.04-LTS

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

#8

帖子 leetking » 2015-05-24 22:02

好了,谢谢大家。这个问题我终于搞定了。
在~/.bash_profile内添加 . ~/.bashrc就好了!!
谢谢大家!!
leetking
帖子: 62
注册时间: 2014-10-28 14:53
系统: ubuntu-18.04-LTS

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

#9

帖子 leetking » 2015-05-24 22:03

好了,谢谢大家。这个问题我终于搞定了。
在~/.bash_profile内添加 . ~/.bashrc就好了!!
谢谢大家!!
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

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

#10

帖子 poloshiao » 2015-05-24 22:46

目前的问题是:
在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 有關 環境變數 的預設
leetking
帖子: 62
注册时间: 2014-10-28 14:53
系统: ubuntu-18.04-LTS

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

#11

帖子 leetking » 2015-05-26 0:33

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 有關 環境變數 的預設
谢谢,就是类似解决了的。
回复