使用修改后的$PATH启动交互式bash登录shell
在我正在开发的GUI应用程序中,我需要打开一个交互式终端窗格,在其中设置路径,以便首先找到正确版本的辅助工具 在某些环境中,特别是在Mac上,终端窗口作为登录shell生成,因为父UI进程没有评估通常的初始化文件,如使用修改后的$PATH启动交互式bash登录shell,bash,macos,Bash,Macos,在我正在开发的GUI应用程序中,我需要打开一个交互式终端窗格,在其中设置路径,以便首先找到正确版本的辅助工具 在某些环境中,特别是在Mac上,终端窗口作为登录shell生成,因为父UI进程没有评估通常的初始化文件,如/etc/profile或$HOME/.bash\u profile 正因为如此,许多人设置了他们的别名、助手搜索/评估(rbenv、rvm等等),以便只为登录shell加载它们 出于这个原因,我希望terminal选项卡打开一个登录shell而不是非登录shell,但是我还没有找到
/etc/profile
或$HOME/.bash\u profile
正因为如此,许多人设置了他们的别名、助手搜索/评估(rbenv、rvm等等),以便只为登录shell加载它们
出于这个原因,我希望terminal选项卡打开一个登录shell而不是非登录shell,但是我还没有找到在所有默认脚本都计算完毕后修改路径的方法
看起来像是bash--login--init file是,--login
/-l
似乎禁用了--init file
执行一个交互式shell并将其传递给配置文件和交互式脚本怎么样:
bash --init-file <(echo 'for p in /etc/profile ~/.bash_profile .bashrc; do
if [[ -f "$p" ]] ; then source "$p"; fi
done')
bash--init file是,--login
/-l
似乎禁用了--init file
执行一个交互式shell并将其传递给配置文件和交互式脚本怎么样:
bash --init-file <(echo 'for p in /etc/profile ~/.bash_profile .bashrc; do
if [[ -f "$p" ]] ; then source "$p"; fi
done')
bash--init file我想只有~/.bash\u profile
,~/.bash\u login
和~/.profile
的第一个版本是源代码<代码>~/.bashrc
从未为非登录shell提供过源代码,至少根据中的“初始化文件决策树”(可能不是原始源代码,我在无数页上看到了相同的内容)。@KimmoLehto,我检查了树,.bashrc
是源代码:交互式?=对→ 登录shell?=不→ <代码>--rc文件
?=不→ <代码>--norc
?=不→ <代码>/etc/bash.bashrc→ <代码>~/.bash\u rc。此外,由于您可以在.bashrc
中定义别名(alias
命令),我会感到惊讶。因此,从.bashrc
配置文件中获取.bashrc
并不罕见。1) 互动的?是2)登录shell?是3)--noprofile
?第4项)/etc/profile
5)第一个~/.bash\u profile
,~/.bash\u登录名
,~/.profile
(可能包括~/.bashrc
我认为只有~/.bash_profile
,~/.bash_login
和~/.profile
的第一次点击才是源代码。~/.bashrc
从未为非登录shell提供源代码,至少根据中的“初始化文件决策树”(可能不是原始来源,我在无数页上看到了相同的东西)。@KimmoLehto,我检查了树,.bashrc
来源:Interactive?=是→ 登录shell?=否→ <代码>--rc文件?=否→ <代码>--norc?=否→ <代码>/etc/bash.bashrc→ ~/.bash\u rc
。此外,由于您可以在.bashrc
中定义别名(alias
命令),我会感到惊讶。从.bash\u配置文件中获取.bashrc
并不罕见。1)交互式?是2)登录shell?是3)--noprofile
?第4个)/etc/profile
5)第一个~/.bash\u profile
,~/.bash\u登录名
,~/.profile
(可能包括~/.bashrc