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

Re: All functions are equal...or ?



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