EDIT: The below is applicable to earlier versions of MSYS2. As of 2020-01-21, it is not required any longer. FeRD's answer seems to work best.
I wanted to use fish instead of bash. Unfortunately most of the methods here didn't work, possibly because fish syntax is so different.
What worked best was wzhd's idea about running
exec fish as the first thing when bash begins. There was still a problem, however: If I wanted to use bash, I had to edit
.bashrc to remove that line because even if I run it from fish it would just start another fish instance.
The best thing to do is to make sure that
exec fish runs when msys2 begins, but not every time bash begins.
The way I found is through the file
msys2_shell.cmd in msys2's installation folder. I found these lines:
if not "x%~1" == "x" set SHELL_ARGS=%SHELL_ARGS% %1& shift& goto :collectparams
It seems they're defining parameters to pass to bash as soon as it begins, but only when this script runs (unlike
.bashrc). So I added this line just after:
set SHELL_ARGS=%SHELL_ARGS% -c "exec fish"
Everything seems to be fine so far. Starting msys2 replaces bash with fish as soon as the former finishes loading, but if I need a bash command line I can still just start it with