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

Bug/Caveat for local variables in functions



Hi,
     This is either a bug, or something which maybe should be noted as not
able to be done in the man page.

You can't create a local variable with the same name as a special var.

Eg:

testit()
{
    local path=foo
    echo $path
}

this echo's your path, not 'foo'. You don't get any warnings about the
assignment not working etc.

The main reason I found it was porting some shell which works in ksh and
bash to zsh compliant (which has a "path" variable).

Regards,
     - Tim




The information contained in this e-mail communication may be confidential.
You should only read, disclose, re-transmit,copy, distribute, act in
reliance on or commercialise the information if you are authorised to do
so. If you are not the intended recipient of this e-mail communication,
please immediately notify us by e-mail to postmaster@xxxxxxxxxx, or reply
by e-mail direct to the sender and then destroy any electronic and paper
copy of this message.

Any views expressed in this e-mail communication are those of the
individual sender, except where the sender specifically states them to be
the views of a member of the National Australia Bank Group of companies.

The National Australia Bank Group of companies does not represent, warrant
or guarantee that the integrity of this communication has been maintained
nor that the communication is free of errors, virus or interference.



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