Ruslan,

1) "declare -x" requirement is wrong. I can now see it was a result of a
strange coincidence.
I set environment variables in .profile. At the same time that I changed
from "export" to "declare -x",
I discovered that MSYS2 gave me both a .bash_profile and a .profile, and I
manually entered
". .profile" for the first time.

2) Here is a copy of MSYS2 screens showing several examples of Windows
cmd.exe displaying different
values for MSYS2 bash.exe environment variables. I grepped and cut to
reduce the size of the display.

rhmcc@rhmZ570 MSYS ~
$ . .profile
/usr/local/bin/wslhome: line 11: cd:
/c/Users//AppData/Local/Packages/*Ubuntu*: No such file or directory
rhmcc@rhmZ570 MSYS /home/rhmcc
$ . $KEHOME/bin/unicon.env
rhmcc@rhmZ570 MSYS /home/rhmcc
env | sort | grep PATH
DPATH=/c/msys64/home/unicon/unicon.5899/ipl/gdata
/c/msys64/home/unicon/unicon.5899/ipl/data
IPATH=/c/msys64/home/ke/KE/lib;/c/msys64/home/ke/KE/uni;/c/msys64/home/ke/KE/parser;/c/msys64/home/ke/KE/hotools;/c/msys64/home/ke/KE/mke;/c/msys64/home/unicon/unicon.5899/ipl/lib;/c/msys64/home/unicon/unicon.5899/uni/lib
LPATH=/c/msys64/home/unicon/unicon.5899/ipl/gincl
/c/msys64/home/unicon/unicon.5899/ipl/incl
MANPATH=/usr/local/man:/usr/share/man:/usr/man:/share/man
ORIGINAL_PATH=/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/
PATH=/c/msys64/home/ke/KE/bin:/c/msys64/home/unicon/unicon.5899/bin:/c/msys64/home/rhmcc/bin:/c/jdk-11.0.2/bin:/c/msys64/home/ke/KE/bin:/c/msys64/home/unicon/unicon.5899/bin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/

rhmcc@rhmZ570 MSYS /home/rhmcc
$ cmd.exe
Microsoft Windows [Version 10.0.17763.379]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\msys64\home\rhmcc>env | sort | grep PATH
env | sort | grep PATH
DPATH=C:/msys64/home/unicon/unicon.5899/ipl/gdata
/c/msys64/home/unicon/unicon.5899/ipl/data
IPATH=/c/msys64/home/ke/KE/lib;/c/msys64/home/ke/KE/uni;/c/msys64/home/ke/KE/parser;/c/msys64/home/ke/KE/hotools;/c/msys64/home/ke/KE/mke;/c/msys64/home/unicon/unicon.5899/ipl/lib;/c/msys64/home/unicon/unicon.5899/uni/lib
LPATH=C:/msys64/home/unicon/unicon.5899/ipl/gincl
/c/msys64/home/unicon/unicon.5899/ipl/incl
MANPATH=C:\msys64\usr\local\man;C:\msys64\usr\share\man;C:\msys64\usr\man;C:\msys64\share\man
ORIGINAL_PATH=C:\Windows\System32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\
PATH=/home/ke/KE/bin:/home/unicon/unicon.5899/bin:/home/rhmcc/bin:/c/jdk-11.0.2/bin:/home/ke/KE/bin:/home/unicon/unicon.5899/bin:/usr/local/bin:/usr/bin:/usr/bin:/opt/bin:/c/Windows/System32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0
C:\msys64\home\rhmcc>

DPATH and LPATH are blank-separated lists -- only the first directory was
changed to Windows format
MANPATH and ORIGINAL_PATH are colon-separated lists -- all directories
correctly changed to Windows format
IPATH is a semicolon-separated list -- not changed, all directories left in
MSYS format
PATH is a colon-separated list -- not changed, all directories left in MSYS
format

Richard H. McCullough
http://ContextKnowledgeSystems.org
What is your context?


On Thu, Mar 21, 2019 at 2:19 AM Ruslan Garipov <ruslanngari...@gmail.com>
wrote:

> > retrieved environment variable values were null.
>
> I still don't understand where you get errors.  Thus, I'll try to guess
> :-)
>
> In MSYS2 environment:
>
> ```
> $ set | grep FOO
> ```
>
> shows nothing.  That's fine.  Go on:
>
> ```
> $ export FOO=foobar
> $ set | grep FOO
> FOO=foobar
> ```
>
> Thus, `${FOO}` isn't "unset".
>
> ```
> $ unset FOO
> $ export FOO=boo; echo ${FOO}
> boo
> ```
>
> The variable is set again.
>
> ```
> $ unset FOO
> $ export FOO=../sample25c; start cmd
> ```
>
> Inside new CMD window:
>
> ```
> prompt> echo %FOO%
> ../sample25.c
> ```
>
> Did I guessed correctly? :-)
>
>
>
>
> _______________________________________________
> Msys2-users mailing list
> Msys2-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/msys2-users
>
_______________________________________________
Msys2-users mailing list
Msys2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/msys2-users

Reply via email to