Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
RE: huh? where did the . come from in my $PATH????
- X-seq: zsh-users 2304
- From: "Andrej Borsenkow" <borsenkow.msk@xxxxxx>
- To: "TjL" <tjlists@xxxxxxxxxxx>, "Zsh Users" <zsh-users@xxxxxxxxxxxxxx>
- Subject: RE: huh? where did the . come from in my $PATH????
- Date: Wed, 14 Apr 1999 17:38:48 +0400
- Importance: Normal
- In-reply-to: <9904140918410.2711-100000@localhost>
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
> if [ -d "$i" ]; then
> PATH=$i:$PATH
>
> Which works niftily, except that at the end of the $PATH is "." !!
>
The very first time PATH is obviously empty and expands to nothing, so you
get
PATH=$i:
empty PATH component is the same as . (current dir).
Use array `path' instead of scalar PATH:
path=($i $path)
Or explicitly test if PATH is not empty
if [[ -n "$PATH" ]]; then
PATH=$i:$PATH
else
PATH=$i
fi
/andrej
Messages sorted by:
Reverse Date,
Date,
Thread,
Author