-
Notifications
You must be signed in to change notification settings - Fork 821
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.bashrc not used when bash.exe -c "echo $ENV"
#24
Comments
This is because (IIRC), running bash.exe does nothing but start the init process for Ubuntu Userspace, it's not actually running bash. A better title would be something like "allow command line parameters through bash.exe", and is more of a feature than a bug |
@crutchcorn It's not true, you are wrong.
|
@patryk9200 @crutchcorn yup,
There are some args which mention the bashrc file, e.g. --norc Looking forward to know if someone figures this out 😄 |
@jamespacileo I found way to load .bashrc ;-) Try something like these:
That should work too:
|
You can make .bat file that will load variables and open bash for you:
|
Snap! Thanks @patryk why didn't I think of this! Sweet and simple 😄👍
|
@jamespacileo I think you can close issue right now ;-) |
@jamespacileo @AlvaroOrduna
is redundant.
Previous version loaded ~/.bashrc twice. |
@patryk9200 ok this might a different issue in disguise then... try the following
It's not outputting anything. Are you getting the same? I thought it was the ~/.bashrc not executing, but it might be something to do with env variables in general when running bash this way |
@jamespacileo You are right that the ~/.bashrc is not executing.
it will start bash inside bash but the second one bash is properly initialized. Bash initialized outside linux shell don't have sourced ~/.bashrc. So it's why i removed source ~/.bashrc;, it was redundant. You can add to ~/.bashrc:
Then if you run
You will get:
But if you remove source ~/.bashrc and run:
You will get:
You can close it now. |
Closing based on the final comment. Please feel free to re-open if this does not solve the OP. |
Hi,
sorry for raising this if it's how it is meant to be. Raising this just in case :)
I've added environment variables as a test in .bashrc.
Environment variables are set when opening bash.exe.
Environment variables are not set when passing a command to bash.exe.
Thanks
The text was updated successfully, but these errors were encountered: