Can I get (the new) bash on Windows 10 to load .profile
12,381
By default, this release of Ubuntu-on-windows loads the file named .bashrc
.
You can either put the script or add the below line to .bashrc
(and create .bashrc
if it is non-existent):
. ~/.profile
Note: If .bashrc
is sourced from .profile
, you may want to comment it out to prevent bash endlessly looping.
Related videos on Youtube
Author by
dhr_p
Updated on June 22, 2022Comments
-
dhr_p almost 2 years
I installed the new subsystem for Linux on Windows 10 (which comes with the Windows anniversary update), and started playing around with it.
What I noticed is that starting the shell (ubuntu bash) does not load .profile or .bash_profile, even though the .profile file exists. Is there a fix?
(And can someone with a lot of reputation make the windows-bash tag?)
-
Benjamin W. almost 8 yearsThat tag exists already: ubuntu-on-windows.
-
dhr_p almost 8 yearsFYI: Feel free to move this to Super User if you guys prefer.
-
-
dhr_p almost 8 yearsThanks luk3yx; but I mentioned specifically that this fails with Ubuntu-on-windows.
-
dhr_p almost 8 yearsAh, it actually works. .bashrc is included/run, even though the system appears to be setup the other way around; as the following lines are included in the default ~/.profile if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi fi
-
Ryan E over 7 yearsIn case it isn't obvious, you probably want to remove/comment the lines that source .bashrc from your .profile otherwise you will wind up in a loop when .profile is sourced in .bashrc