Re: Basic concept questions related to setting PATH
Re: Basic concept questions related to setting PATH
On Wed, Apr 09, 2003 at 10:23:43PM -0500, Allan Seidel wrote:
>
> Entering $PATH in xterm results in a string of paths ending with ":
> Command not found". My .cshrc file points to init.csh. Init.csh
> has the line "set path = ( /sw/bin /sw/sbin $path /usr/X11R6/bin )".
> The Init.sh file has the line
> "PATH=/sw/bin:/sw/sbin:$PATH:/usr/X11R6/bin". Both these files look
> like they serve the same purpose.
They do, but for different shells. command shells in UNIX come in two
broad flavours, those that are like csh (csh and tcsh) and those that
are like the Bourne shell (sh, ksh, bash, zsh and several others)
Init.csh is for csh family shells, and Init.sh is for Bourne family
shells. They have different syntaxes.
The default shell on Mac OS X is tcsh, so unless you've changed that,
you should be using Init.csh
> Ok, so which line set the path? I read in a tutorial that path and PATH
> are set to the same when one changes them. Yet I see that $path and
> $PATH have different results.
$path and $PATH are only magically tied to each other in csh family
shells. In Bourne shells, $path doesn't do anything - only $PATH
matters (this is actually true of the operating system itself - it's
only the csh family shell which knows about the 'path' variable)
If you're using csh, these should never be different.
> Trying to add to the end of the PATH with every variation of set PATH
> I've seen does nothing. I'm thinking the "Command not found" has
> something to do with this because I can add to the front end of the
> PATH if the syntax includes a ":" between the paths instead of a space.
> What gives here? I could ask more questions here. I'd like to grok
> these few items first.
In csh, variables like path can be lists. The syntax for a list is:
( item1 item2 item3 )
However, the traditional form of a PATH variable, in both shells, is
that the list of directories are delimited by a colon:
item1:item2:item3
csh shells automatically keep the two synchronised for the path variable
and its equivalent PATH environment variable. For example:
[dhcp170:~] tim% set path = ( a b )
[dhcp170:~] tim% echo $path
a b
[dhcp170:~] tim% echo $PATH
a:b
[dhcp170:~] tim% setenv PATH c:d
[dhcp170:~] tim% echo $PATH
c:d
[dhcp170:~] tim% echo $path
c d
[dhcp170:~] tim%
Tim.
PS. This is really a generic UNIX question, and shouldn't be on this
X11.app list.
A very useful "getting started with unix" web site is this one:
http://unix.t-a-y-l-o-r.com/
--
Dr Tim Cutts
Informatics Systems Group
Wellcome Trust Sanger Institute, Hinxton, Cambridge, CB10 1SA, UK
_______________________________________________
x11-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/x11-users
X11 for Mac OS X FAQ: http://developer.apple.com/qa/qa2001/qa1232.html
Report issues, request features, feedback: http://developer.apple.com/bugreporter
Do not post admin requests to the list. They will be ignored.