From what I understand bin\bash.exe invokes usr\bin\bash.exe I guess with some options to help manage windows paths but can't find any documentation to indicate that.
All I know is my scripts seem not to work as expected if I have my environment set to use Git\usr\bin\
rather than Git\bin
.
A new dev box seems to have this setup:
where bash
C:\Windows\System32\bash.exe
C:\Program Files\Git\usr\bin\bash.exe
I can understand wsl being top but can't understand the second entry if bin/bash.exe
is the one I am supposed to use?
Git is a version control system that lets developers track source code changes during software development. Git Bash is an application for Microsoft Windows, allowing developers to use Git in a command-line interface.
Bash is an acronym for Bourne Again Shell. A shell is a terminal application used to interface with an operating system through written commands. Bash is a popular default shell on Linux and macOS. Git Bash is a package that installs Bash, some common bash utilities, and Git on a Windows operating system.
Git CMD is just like regular Windows command prompt with the git command. It lets you use all of Git features through command line. Useful if you are already familiar with Windows cmd and you only work on Windows. Git Bash emulates a bash environment on windows.
You don't need to use Git Bash. It is just conventional, because Git was developed and designed on Linux and most Git users use Linux and using Git Bash on Windows makes it a uniform experience. You can certainly use Git on cmd; just make sure you add C:\Program Files\git\cmd to your PATH .
%windir%\system32\bash.exe
= inline bash shell hosted by whatever windows subsystem for linux [ wsl ] environment you have enabled using microsoft store | windows subsystem for linux | | install. An alternative but essentially same result as the separate window that start menu shortcut %windir%\system32\wsl.exe ~ -d Ubuntu
launches.
%programfiles%\git\bin\bash.exe
-> %programfiles%\git\usr\bin\bash.exe + some automatically injected arguments
= inline [ main stdin/stdout ] bash shell provided by git layered on top of windows cmd.exe command prompt environment
%programfiles%\git\git-bash.exe
= windows app [ winmain ] bash shell provided by git layered on top of windows cmd.exe command prompt environment
So it appears that:
"C:\Program Files\Git\usr\bin\bash" -li
yields:
Me@MYPC MSYS /usr/bin
and
"C:\Program Files\Git\bin\bash" -li
yields:
Me@MYPC MINGW64 /usr/bin
So to my eyes that implies the EXE are compiled differently.
But in my case the issues I was having with my scripts was purely down to the PATH each exe sets up:
For
"C:\Program Files\Git\usr\bin\bash.exe"
$ where FIND
C:\Windows\System32\find.exe
C:\Program Files\Git\usr\bin\find.exe
Whereas:
"C:\Program Files\Git\bin\bash.exe"
$ where FIND
C:\Program Files\Git\usr\bin\find.exe
C:\Windows\System32\find.exe
So my script in the former case was failing with a
FIND: Parameter format not correct
as it wasn't finding the correct version of find.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With