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

Re: path problem when zsh is a login shell



On Tue, Jul 14, 2015 at 9:18 AM, <covici@xxxxxxxxxxxxxx> wrote:

> I am new to zsh, so please be patient.  So if I use zsh as a login shell
> I have in my /etc/zshenv
> if [ -e /etc/profile.env ] ; then
>         . /etc/profile.env
> fi
> umask 027
> path=(
> $PATH
> )
>

Don't do that. $PATH is a colon separated sequence of directories. It's a
single string. When you do the array assignment you are assigning to the
"path" array a single string. For example, if $PATH is set to "/a:/b:/c"
when you execute

echo $#path $path

you should see this line printed:

3 /a /b /c

Now execute

path=( $PATH )
echo $#path $path

Notice that the path array now contains a single word:

1 /a:/b:/c

Since you probably don't have a directory named "/a:/b:/c" no non-builtin
commands will be found.

Also, $path and $PATH are already bound together which means that if you
change one you're automatically changing the other. In other words, you
don't need to assign to both of them.

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank


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