Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: for syntax differences from ksh
- X-seq: zsh-users 1089
- From: Sweth Chandramouli <sweth@xxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxxx
- Subject: Re: for syntax differences from ksh
- Date: Sat, 18 Oct 1997 02:09:45 -0400
- In-reply-to: <971017084433.ZM7615@xxxxxxxxxxxxxxxxxxxxxxx>
- References: <199710170925.KAA05948@xxxxxxxxxxxxxxxx> <199710170925.KAA05948@xxxxxxxxxxxxxxxx>
At 11:44 AM -0400 on 10/17/97, Bart Schaefer wrote:
> On Oct 17, 10:25am, Andrew Main wrote:
> } Subject: Re: for syntax differences from ksh
> }
> } Sweth Chandramouli wrote:
> } >
> } >addpath () {
> } >for pathdir in $*; do
> } > if test -d $pathdir; then
> } > PATH=$PATH:$pathdir
> } > fi;
> } >done
> } >}
> }
> } This function is correct for zsh.
>
> Yes, but I'd recommend
>
> PATH=${PATH}:$pathdir
>
> because of zsh's `:' variable modifiers. It happens to work here because
> zsh ignores the `:' when it is not followed by a recognized modifier, but
> I think it's a bad habit to rely upon that.
in a search for a better habit: is it then always correct to enclose
the variable name in braces? i remember being told at some point not to do
so, though i think that was for a different shell altogether.
(thanks to everyone who explained the word splitting problem; as soon
as the first person pointed it out, i remembered reading it in the faq.
doh!)
-- sweth
Messages sorted by:
Reverse Date,
Date,
Thread,
Author