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

Re: for syntax differences from ksh



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.

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



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