0

Inspecting the stdout the invocation of env utility without supplying an operand it returned a name=value pair whose meaning I don't understand nor was able to find any documentation

$ env
...
!::=::\
...
TERM=cygwin
MSYSTEM_PREFIX=/mingw64
...

In the POSIX specification it is stated that

STDOUT
    If no utility operand is specified, each name= value pair in the
    resulting environment shall be written in the form:
"%s=%s\n", <name>, <value>

I'm using msysgit on a machine running Windows 10.

$ git --version
git version 2.22.0.windows.1

$ printf "%s\n" $BASH_VERSION
4.4.23(1)-release

Started a new session and the result is the same.

Executing the same env command on cmd.exe returns

C:\>env
!::=::\
!C:=C:\
...

What is the meaning and purpose of this name=value pair?

Paulo Tomé
  • 3,782
  • Are you sure that's a name/value pair and not part of the value of something else? Environment variables' values can contain equal signs and newlines – muru Feb 28 '20 at 12:46
  • 1
    On what system? What shell? I see you have tagged with POSIX, why? Are you using a POSIX shell on a POSIX system? Does this happen for all users or only you? Does it happen in a new session? I don't see this output on my Arch with bash nor on 2 Ubuntu systems I tried. – terdon Feb 28 '20 at 12:46
  • @terdon The reason for the POSIX tag is due to env utility being specified in the standard. – Paulo Tomé Feb 28 '20 at 13:00
  • So this is something inherited from Windows ... I think this should be asked on [su] and is offtopic here. – muru Feb 28 '20 at 13:10
  • Or maybe SO if it's some sort of git tool. In any case, that won't be a POSIX shell and it seems to be a specific issue with this git thing. – terdon Feb 28 '20 at 14:08
  • @JdeBP Yes it does. This question should be marked as duplicated. – Paulo Tomé Feb 28 '20 at 16:10

0 Answers0