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
6e6310d (filesystem: New specific variable MSYS2_PS1., 2016-05-01)
introduced the MSYS2_PS1 prompt script priority to allow multiple
device configurations.
Unfortunately, if MSYS2_PS1 was not set it overwrote the $PS1, even
when specifically set by the users configuration, such as provided in the
Git-for-Windows SDK (see https://github.com/git-for-windows/git/issues/794#issuecomment-227401839)
and the monkey patch fix (https://github.com/git-for-windows/build-extra/pull/122).
Introduce a priority order so that the user's $PS1 (if set) has an
intermediate priority between the MSYS2_PS1 and the default PS1.
Signed-off-by: Philip Oakley <philipoakley@iee.org>
* Avoid continuously appending items to MANPATH and INFOPATH when
sourcing /etc/profile multiple times.
* Check for .bashrc existence in shell manager.