I'm very new to powershell. I've been borrowing a laptop from my company for less than a week, and that encompasses my entire experience with windows. However, I may have found a solution that works (at least for me).
(inspired by https://superuser.com/questions/1090141/does-powershell-have-any-sort-of-bashrc-equivalent)
In PowerShell:
New-Item $profile -Type File -Force
It creates a file called Microsoft.PowerShell_profile.ps1 in a folder called WindowsPowerShell under your Documents folder. Then you can open it with a text editor:
notepad $profile
Add $bash = [bash | . ~/.bash_profile]
to that file.
Now when entering bash from powershell, your bash_profile should be sourced automatically. I can type env
, for example, and all of the local variables specified in my bash_profile are present. I imagine that this would also work with .bashrc, but I haven't tried that yet.
For the record, this is just an extension of Marvin Mustafa's answer. But I'm not sure that his method would fix the problem I was having, which was that I had to resource my bash_profile every time I started a new command prompt in windows.
Hope this is useful.
**** EDIT ****
This solution worked for me but I got complaints from windows from doing certain actions. I think the better solution, although potentially problematic as well, is to edit /etc/bash.bashrc
and add source ~/.bash_profile
. After doing this my PS1, profile variables, etc. were shown in env
. Good Luck.