You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When bash.exe is run without arguments, it invokes /bin/bash with no flags; this results in an interactive, non-login shell. But this is generally understood to mean a subshell invoked in a session that has already had a login shell run (-bash or bash --login), which is how .profile or .bash_profile get invoked. So the environment and other aspects of the session may not be configured as expected.
In the WSL environment, a login shell might not be the right thing. But what's happening now isn't quite right either.
Reacted by Carl Patenaude-Poulin, Dylan Katz, Giovanni Bassi and Bradley Bauer
You bring up an Interesting point. I'll play around with what happens if we switch to launching bash with the --login argument. If you want to try this locally and see if things work better for you can run: bash.exe -c "/bin/bash --login"
cgull - regarding launching bash as a login shell, we pass command line parameters to /bin/bash so if you use "bash.exe --login", /bin/bash will be launched with the same arg. Going to go ahead and close out this thread but feel free to follow up if this workaround doesn't work for you.
Ben Hillis (@benhillis) , when invoked (eg from a shortcut) as bash --login, it doesn't seem possible to make the initial directory ~? It uses the windows current directory, or /mnt/c/Windows/System32, which of course can't be a VolFs path.
Not sure if that counts as this bug, but it is a bit uglier to use bash -c "cd ~ && bash --login".
Simon Buchan (@simonbuchan) Thanks for bringing this up again. I took a look at bash.exe's command line parsing and we actually have a bug there that only allows '' to be used if it's the only command line argument. I have a fix that will strip the '' from the command line and pass remainder to /bin/bash.
This will allow you to do the following types of things:
Launch bash as a login shell in the user's home directory (bash.exe ~ --login)
Pass an initial command to /bin/bash to execute in the user's home directory (bash.exe ~ -c "ls").
If the ~ is not the first character it will be passed to /bin/bash. (bash.exe -c "ls ~")
I'll be checking this change into our dev branch soon so you'll have to wait a while for the fix, but hopefully that will make the '~' argument more useful.
Reacted by Simon Buchan, Brett Whiteman, Bobby Johnson and Tomas Gerulaitis
In case the above formatting confuses anyone else, I think this is what was intended:
...
we actually have a bug there that only allows ~ to be used if it's the only command line argument. I have a fix that will strip the ~ from the command line and pass remainder to /bin/bash.
...
Activity
benhillis commentedon Apr 13, 2016
You bring up an Interesting point. I'll play around with what happens if we switch to launching bash with the --login argument. If you want to try this locally and see if things work better for you can run:
bash.exe -c "/bin/bash --login"dreyks commentedon Apr 13, 2016
the new shell is starting though. not sure what's causing this
benhillis commentedon Apr 14, 2016
The operation not permitted issue on /dev/tty is something I fixed recently and should be one of the next flights.
Internally I've been playing launching bash with this option and it seems to me that there aren't any downsides launching bash with this option.
benhillis commentedon Apr 19, 2016
cgull - regarding launching bash as a login shell, we pass command line parameters to /bin/bash so if you use "bash.exe --login", /bin/bash will be launched with the same arg. Going to go ahead and close out this thread but feel free to follow up if this workaround doesn't work for you.
simonbuchan commentedon May 12, 2016
Ben Hillis (@benhillis) , when invoked (eg from a shortcut) as
bash --login, it doesn't seem possible to make the initial directory~? It uses the windows current directory, or/mnt/c/Windows/System32, which of course can't be a VolFs path.Not sure if that counts as this bug, but it is a bit uglier to use
bash -c "cd ~ && bash --login".benhillis commentedon May 13, 2016
Simon Buchan (@simonbuchan) Thanks for bringing this up again. I took a look at bash.exe's command line parsing and we actually have a bug there that only allows '
' to be used if it's the only command line argument. I have a fix that will strip the '' from the command line and pass remainder to /bin/bash.This will allow you to do the following types of things:
I'll be checking this change into our dev branch soon so you'll have to wait a while for the fix, but hopefully that will make the '~' argument more useful.
kdbanman commentedon Apr 1, 2017
In case the above formatting confuses anyone else, I think this is what was intended:
muru commentedon Jun 7, 2017
This can probably be marked as fixed in insider builds (same as #816) now.