A)A short-short answer is : in some file like
x:\MSYS2\home\some_name\.bash_profile ,
add these lines:
# ---- modify : j is j-Windows drive
tt=/j/MSYS2/mingw64/bin
PATH="${tt}:${PATH}"
B)A short answer is : in some file like
x:\MSYS2\home\some_name\.bash_profile ,
add these lines:
# pathz was defined in Windows using e.g. set pathz=%cd% before loading MSYS2
# You can also set it here (in Windows-format like 'c:\my\bin)
tt="${pathz}"
tt=\/"${tt}"
tt="${tt/:/}"
tt="${tt//\\//}"
PATH="${tt}:${PATH}"
# ---- modify these 2 lines :
mkdir -p "${tt}"/../2WORK
cd "${tt}"/../2WORK
#some tests :
input="a\b\c\d"
echo ${input}
echo "${input/\\//}"
echo "${input//\\//}"
echo "Note that : only the last echo with '//', not '/', to begin, give us global replace !!"
C)An instructive answer is :
1)Create a dir . In this dir, create a file named qqq.cmd that contains :
rem cd = current dir
set pathz=%cd%
set path=%pathz%;%path%
set pathzz=%path%
:: pathz and pathzz can be used in cygwin and MSYS2 , but must be translated.
if "%1" == "" (
rem ---- modify this line :
I:\MSYS2\msys2_shell.cmd -ucrt64
exit
)
set ZZZZZZ=123aBBC1111111111111
set zZZz=123aBBC
rem ---- modify this line :
I:\CYG\bin\mintty.exe -i /Cygwin-Terminal.ico -
exit
2)In this dir, create another file named ss that contains :
#ss
#in notepad++ : click Edit , choose EOL conversion , then choose unix for this file ss. (no extension).
echo $PATH
echo $path"assss----------"
echo $ZZZZZZ
echo $zZZz
echo $ZZZZ--=====++++++
echo $zZZz
echo $PATHZ --------
echo $pathz --====
cd /c
echo --------Note current dir :
pwd
if false; then
# ... Code I want to skip here ...
fdsgfsdsgfs
dfsdgfdsgfds
fi
exit
3)Do as in B) .
4)Create shortcut for qqq.cmd and move the short cut to any where.
5)Then execute qqq.cmd by double clicking the shortcut and now you have MSYS2. Type ss and check the output and note the current dir now!!
NB: if you modify qqq.cmd to load Cygwin then 3) above not needed