Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATH fails with non-existing directory..



On Mar 24,  9:13am, Max R. Andersen wrote:
} Subject: Re: PATH fails with non-existing directory..
}
} > What you want is either
} > 
} > % PATH=/usr/bin/:/nonexisting/name
} > 
} > or
} > 
} > % path=( /usr/bin/ /nonexisting/name )
} 
} Ok - then a few questions arises:
} 
} 1. In which order is path and PATH used ?

When zsh starts up, it splits the $PATH string from the environment at
colons to make the array $path (which is not part of the environment;
it's a "shell variable," also called a "parameter" in the zsh docs).

Thereafter, any time you assign to PATH, the string is split and then
assigned to path, and any time you assign to path the array is joined
with colons and the resulting string is assigned to PATH.  So the two
are always in lock step, but it is the array that zsh scans when doing
a command search.

} 2. what can I do to convert a variable from colon-seperated list to an
} array ?

For PATH and path, you don't need to do anything special.  Assign to PATH
(see my example above) and zsh will automatically fix everything for you.

This is all explained in the manual, of course ...

} I need this as the university im using zsh uses colon-seperated lists
} for their systemwide paths 

You probably don't need to do anything at all, then.  Zsh will import
the PATH environment when it starts up.

Or are you perhaps attempting to execute some tcsh code in zsh?  That
won't work; zsh syntax is much closer to bash or sh, so close that it
can usually execute their scripts, but it can't execute tcsh scripts.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com



Messages sorted by: Reverse Date, Date, Thread, Author