* Remove double quotes of the LOGINSHELL
When set shell arguments, LOGINSHELL has double quotes.
In the default, L6: set "LOGINSHELL=bash".
I followed the format it.
* Add value to $SHELL for zsh
Issue:
1. Run, C:\msys64\msys2_shell.cmd -mingw64 -shell zsh
2. echo $SHELL
3. Nothing
* Fix msys2_shell.cmd argument-handling with spaces
Commit 11ba641bed intended to preserve [`cmd.exe` delimiter characters](https://ss64.com/nt/syntax-esc.html#delimiters) in the command line passed on to `bash`, but broke the handling of `-where` directories with spaces in them. Fix this by:
- Incrementing `shiftCounter` with any quoted arguments treated as separate words, because the `FOR /F ... IN`-loop at the end cannot treat them (in the full command) as single parameters.
- Using the full list of `cmd.exe` delimiters in the `FOR /F ... IN`-loop when skipping the initial tokens.
Tested this with:
```
C:\msys2\msys2_shell.cmd -defterm -no-start -mingw64 -where <DIR> -shell bash -c $@ -- echo hello there, --world=windows
```
where `<DIR>` is the following:
- C:\Users
- C:\Progra~1
- "C:\Program Files"
- "C:\Program Files (x86)"
- "C:\Users\T-17\Documents\Projects and Learning\test,dir"
Fixes#1826
* Clean up `FOR /F ... IN`-command
* Clean up working variables
* Adhere to lowercase CALL convention
* Prefix working variables with `msys2_` to prevent collisions with user-defined variables
* Don't clobber quotes and parentheses in final Bash command line
* Prevent warning trace on no arguments
* Handle cmd.exe metacharacters (e.g. parentheses) in Bash command line
Consider this inline invocation in a Windows Command Prompt:
```
C:\msys2\msys2_shell.cmd -defterm -no-start -mingw64 -here -c $@ -- echo hello there, --world=windows
```
This currently produces:
>hello there, --world windows
Note the absence of the `=` character. This is due to the word-splitting done by `cmd.exe` to form the positional parameters (`%1` - `%9`). The same word-splitting is not done on the `%*` special variable, so derive the remaining command line arguments.
With this fix, the above command produces:
>hello there, --world=windows
The variable 'as_echo' is not set in a virgin shell, but by 'autoconf'
and friends. Setting the default value to 'echo' facilitates running
'configure' in a virgin shell.
* filesystem/main-config.site: see above.
* filesystem/mingw32-config.site: see above.
* filesystem/mingw64-config.site: see above.
Fixes#1518
If msys2 bash is set as the DefaultShell for the Win10 OpenSSH server,
there is no way to pass -l to make it a login shell, so /etc/profile is
not sourced, PATH is not set, and the bashrc produces errors.
Detect this case in /etc/bash.bashrc, by checking for the SSH_CONNECTION
environment variable and PATH not having msys2 elements, and source
/etc/profile.
Enables users to take action (e.g. in `~/.bash_profile`) if msys was invoked with `CHERE_INVOKING` set.
Example usage (start in same directory as at last logout) :
Add to ~/.bash_profile:
# Change to pwd at last logout unless $CHERE_INVOKING was set
if [ ! -z "${CHERE_INVOKING_VISIBLE_FOR_USER}" ]; then
unset CHERE_INVOKING_VISIBLE_FOR_USER
else
[ -s ~/.lastdirectory ] && cd `cat ~/.lastdirectory`
fi
Add to ~/.bash_logout:
pwd > ~/.lastdirectory