delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/01/03/16:24:13

From: flitterio AT amulet DOT com (Fran Litterio)
Subject: Value of _PATH replaces PATH in shell scripts! Why?
3 Jan 1997 16:24:13 -0800 :
Sender: daemon AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <c=US%a=_%p=Amulet._Inc.%l=JAGUAR-970103222407Z-2808.cygnus.gnu-win32@jaguar.amulet.com>
Mime-Version: 1.0
Original-To: "'gnu-win32 AT cygnus DOT com'" <gnu-win32 AT cygnus DOT com>
X-Mailer: Microsoft Exchange Server Internet Mail Connector Version 4.0.994.63
Original-Sender: owner-gnu-win32 AT cygnus DOT com

Recently I reported a problem where the value of PATH was corrupted in
all of my shell scripts and that I couldn't run scripts except by
explicit pathname (i.e., just typing "foo" would not run script foo -- I
had to type "bin/foo").  I've tracked it down to something wierd:

    If your environment has the variable _PATH in it (note the
    leading underscore), then the value of _PATH replaces the
    value of PATH in shell scripts!

I was setting my NT path like so (using the Environment tab of the
System Properties dialog):

	_PATH=c:\franl\bin;c:\winnt\system32;c:\winnt;c:\dos;c:\whatever
	PATH=%_PATH%

This, combined with the above wierd behavior, was causing all of my
shell scripts to fail with this error

	scriptname: scriptname: No such file or directory

which is the classic sign that the shell named in the #! line of the
script can't be found.  But my scripts all start with #!/bin/sh, and I
have the cygwin32 bin directory mounted on /bin, and I have bash
installed as both /bin/bash.exe and /bin/sh.exe.

So I stopped setting _PATH in my NT environment, and I put this in my
bash startup file:

	export _PATH="$PATH"

and all my shell scripts work again -- perfectly.  I can even run them
without using explicit pathnames.  Happiness.

But can anyone explain this _PATH thing?  Is this an NT feature (the
MSDN CD had zero to say about it)?  Or is bash/cygwin.dll causing this
behavior?
--
Francis Litterio
franl AT amulet DOT com

-
For help on using this list, send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019