-
Notifications
You must be signed in to change notification settings - Fork 859
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 run twice for non-interactive shell with BASH_ENV shared via WSLENV #2897
Comments
This could be related to post at https://superuser.com/questions/671372/running-command-in-new-bash-shell-with-rcfile-and-c Is If yes, then this is expected wonky behavior and putting a |
@diablodale. Yes you are looking at the same case as the superuser post, for sure. This is all grounded in the semantics of (the tragically named)
That returns two lines not three. What
Which gives three lines. This was improved with the introduction of
Which returns two lines. Ben will have to weigh in for closure. |
- workaround for microsoft/WSL#2897
- workaround for microsoft/WSL#2897
* no-i: conditional .bashrc loading for Win10 builds 17063+ - Win10 builds 17063+ support sharing env vars w/ WSL - when WSLENV and BASH_ENV are shared, will launch WSL as non-interactive - Win builds prior (e.g. FCU) will not get this feature Use wsl.exe to workaround double run of .bashrc - workaround for microsoft/WSL#2897 call WSL git non-interactively yet still with .bashrc
.bashrc is running twice when a non-interactive bash shell is started with
bash -c
while at the same timeBASH_ENV
is set to~/.bashrc
and shared withWSLENV=BASH_ENV
Setup
Microsoft Windows [Version 10.0.17074.1002]
Clevo P150em laptop with Intel i7-3720qm and 16GB ram
Current Windows Updates
Current apt updates/upgrade
Repo
echo "running profile"
echo "running bashrc"
case/esac
block which begins with# If not running interactively, don't do anything
esac
of that block, addecho "interactive"
bash
and press enter.running profile
,running bashrc
, andinteractive
.If you did not get three lines, go back to step 1 above and troubleshoot.
exit
and press enter.bash -c "echo hello"
and press enter.hello
.If you did not get that single line, stop and troubleshoot.
set BASH_ENV=~/.bashrc
and press enterset WSLENV=BASH_ENV
and press enterbash -c "echo hello"
and press enter.Result
Three lines:
running bashrc
,running bashrc
,hello
Expected
Two lines:
running bashrc
,hello
The text was updated successfully, but these errors were encountered: