1.7.7: PATH in Bash shells

David Sastre d.sastre.medina@gmail.com
Sun Feb 6 19:16:00 GMT 2011


On Sun, Feb 06, 2011 at 01:33:37PM -0500, Gerry Reno wrote:
> What is the proper method to set the PATH variable on a system-wide
> basis in Cygwin?
> 
> Right now in the Cygwin Bash shell the PATH is set to:
> 
>     bash-4.1$ echo $PATH
>     /cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wb
>     em:/cygdrive/c/Program Files (x86)/Microsoft SQL
>     Server/90/Tools/binn/:/usr/bin

First off, I'm curious about how do you start the bash shell. I ask
because you don't seem to have PS1 set correctly, and that should be
automated by startup-scripts. 
 
> I think what I need is for the system-wide PATH to look something like this:
> 
>     /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/Program
>     Files (x86)/Microsoft SQL Server/90/Tools/binn/

And that's how it should look like. The fact that you have cygwin's
paths *after* windows paths in your PATH is something you probably have
modified by hand.
 
> Is the PATH setting I'm looking for workable with Cygwin? 

The PATH variable in cygwin is exported from your /etc/profile
file, which contains a line that sets cygwin's path with higher
precedence over the PATH inherited from windows.

> Or do the Windows paths need to come first for some reason?

Quite the opposite.

> Is there some guiding document about setting PATH system-wide to better
> support scripts from Linux?
 
Yes. The info you need is in the bash manpage, INVOCATION section.

-- 
Huella de clave primaria: 0FDA C36F F110 54F4 D42B  D0EB 617D 396C 448B 31EB
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20110206/cfca458f/attachment.sig>


More information about the Cygwin mailing list