小编Ken*_*rty的帖子

如何获得与父 shell 具有完全相同的当前环境的交互式 Bash 子 shell?

我想为自己\xe2\x80\x94和许多其他用户\xe2\x80\x94创建一个脚本,该脚本将配置使用特定版本工具集\xe2\x80\xa6的环境,然后使用该脚本打开一个交互式shell环境。

\n\n

似乎发生的情况是~/.bashrc执行了各种用户初始化脚本 ( ) 并破坏了部分设置。

\n\n

许多用户(包括我自己)在其 \xe2\x80\xa6 中配置了默认版本的工具~/.bashrc,并希望保持这种状态。

\n\n

我为其制作此脚本的备用版本仅在一小部分时间内使用。

\n\n

我已经尝试过以下方法:

\n\n
setup the environment\nbash\n      # runs ~/.bashrc and breaks the setup\n\nbash -i\n      # runs ~/.bashrc and breaks the setup\n\nbash --rcfile <(echo echo in subshell... $PATH)\n      the displayed $PATH is correct - but I immediately return\n      to the parent (no longer a subshell - not interactive)\n\nbash --rcfile -i <echo echo in subshell... $PATH)\n      the displayed $PATH is correct - but I immediately return\n …
Run Code Online (Sandbox Code Playgroud)

bash

5
推荐指数
1
解决办法
1595
查看次数

标签 统计

bash ×1