I have script foo.sh in my Cygwin directory /usr/local/bin. I can run it using mintty, but not using bash.
When I started, the situation was as follows:
foo.sh in mintty - WORKING
foo.sh in bash - NOT WORKING
Then I added line export PATH="${PATH}:/usr/local/bin" to my .bashrc file. Now situation is as below:
foo.sh in mintty - WORKING
foo.sh in bash - WORKING
however
bash -c foo.sh - NOT WORKING
I need the last method of running the script to work. I will use it in my executable, which is compiled for Windows, so the command musts work in cmd.
My questions are:
PATH, to work with bash -c./usr/local/bin is not in PATH by default? Is it any reason to don't do that I'm trying to do?The .bashrc file is only executed for non-login shells. For environments like this, I recommend including .bashrc from .bash_profile:
echo '. "${HOME}/.bashrc"' >> ~/.bash_profile
This way, your .bashrc will be included for both login and non-login shells.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With