When I call a bash
shell from another program to execute an command string I call
bash -c <shell commands>
This works pretty well, but the shell which gets invoked does not read the startup file .bashrc
. I need this for environment variables and aliases set in the start-up file.
I tried
bash -i -c <shell commands>
and
bash -l -c <shell commands>
to read .bashrc
or .bash_profile
but didn't have any luck. How can I enforce reading of a start-up file?
Note: I tried this only on Cygwin bash 4.1.0, but I assume this is a machine-independent issue.
As the comments mentioned,
bash -i -c
does indeed source the start-up file.
I did something wrong in Emacs, my calling app; that's why it didn't work for me.
Apologies for the unnecessary question.