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

Re: All functions are equal...or ?



From: Frank Terbeck <ft@xxxxxxxxxxxxxxxxxx>
Subject: Re: All functions are equal...or ?
Date: Thu, 15 Feb 2007 13:14:02 +0100

Hi Frank,

 thanks a lot for the corrections!

 I am curious to know, why "local -a cmdarray" is needed here... ?!

 Keep zshing!
 mcc

> Meino Christian Cramer <Meino.Cramer@xxxxxx>:
> [...]
> > lww () {
> 
>           local -a cmdarray
> 
> Defining $cmdarray as a local array fixes this problem. $cmdarray
> would otherwise be created as a global parameter. I'm setting the
> 'warncreateglobal' option to be alerted, when I'm doing that myself.
> I actually fail to see, _why_ this fixes the problem, yet it does. :-)
> 
> [...]
> >         if [ ! -z $1 ]
> >         then
> >                 echo
> >                 case `whence -w $1 | cut -d' ' -f 2` in
> 
>                   case ${$(whence -w print)[2]} in
> 
> Away with that cut! :)
> 
> [...]
> >                 esac
> >                 cmdarray=("${(f)$(whence -pa $1)}")
> 
>                   cmdarray=(${(f)"$(whence -pa $1)"})
> 
> Um, this is just the I'm used to write this, which I thought was
> accurate. Can someone comment on what the difference between
> ${(f)"$( foobar )"} and "${(f)$( foobar ) }" is, if there's any?
> 
> >                 echo ${#cmdarray}                     ## 1
> [...]
> 
> Regards, Frank
> 
> -- 
> In protocol design, perfection has been reached not when there is
> nothing left to add, but when there is nothing left to take away.
>                                                   -- RFC 1925



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