Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > $path vs. $PATH

$path vs. $PATH
Thread Tools
Mac Elite
Join Date: Jan 2000
Location: Seattle, WA, King
Status: Offline
Reply With Quote
Dec 28, 2002, 12:57 PM
 
Output from shell:

Code:
[IP41-85:~] bmedina% echo $path /bin /sbin /usr/bin /usr/sbin [IP41-85:~] bmedina% echo $PATH /bin:/sbin:/usr/bin:/usr/sbin
Does anyone know why there is a difference in the two formats? I was editing $PATH with the format for $path and screwed everything up.

It seems as though the two variable are always the same, just in a different format. What gives?
     
Fresh-Faced Recruit
Join Date: Apr 2002
Status: Offline
Reply With Quote
Dec 28, 2002, 02:34 PM
 
$path is a shell variable and $PATH is an environment variable.

The shell keeps some shell variables (such as user, term and path) in sync with their environment variable equivalents (USER, TERM, PATH).

The difference between shell and environment variables is that environment variables are available to programmes (like shell scripts) run from the shell, ie: they are "exported". Shell variables are not.

Shell variables are set with "set" and environment variables are set with "setenv".

Suffice to say, $PATH is delimited with : and $path with a space.
     
bmedina  (op)
Mac Elite
Join Date: Jan 2000
Location: Seattle, WA, King
Status: Offline
Reply With Quote
Dec 28, 2002, 07:40 PM
 
Thanks for the info.

So if I want to add a directory to my path, should I modify $PATH or $path? Or does it even matter?
     
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Dec 28, 2002, 10:36 PM
 
Heh...try one or the other and see!

IIRC, if you change one, the other will change too...
[Wevah setPostCount:[Wevah postCount] + 1];
     
Admin Emeritus
Join Date: Nov 2000
Location: New Yawk
Status: Offline
Reply With Quote
Dec 29, 2002, 12:56 PM
 
It doesn't matter, but $path is a tcsh thing. You can use either one you want. So either just do something like set path = (/bin /sbin) or setenv PATH '/bin:/sbin' or something else if you use a different shell. They are synced so use whichever syntax you find easier.
"Do not be too positive about things. You may be in error." (C. F. Lawlor, The Mixicologist)
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:47 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2