当我bash
从另一个程序调用 shell 来执行我调用的命令字符串时
bash -c <shell commands>
这工作得很好,但是被调用的 shell 不会读取启动文件.bashrc
。我需要在启动文件中设置环境变量和别名。我试过了
bash -i -c <shell commands>
和
bash -l -c <shell commands>
阅读.bashrc
或.bash_profile
但没有任何运气。如何强制读取启动文件?
注意:我只在 Cygwin bash 4.1.0 上试过这个,但我认为这是一个与机器无关的问题。