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

Re: [BUG] emulate sh: arith assignment assigns variable type



On Sat, Jan 2, 2016 at 7:11 PM, Peter Stephenson
<p.w.stephenson@xxxxxxxxxxxx> wrote:
> On Fri, 01 Jan 2016 21:03:33 +0100
> Martijn Dekker <martijn@xxxxxxxx> wrote:
>> When an assignment is done to an unset variable using an arithmetic
>> expression, zsh assigns a numerical or arithmetic type to that variable,
>> causing subsequent normal shell assignments to be interpreted as
>> arithmetic expressions.
>
> Yes, it does.
>
> Does this need a special option?  The linkage is a bit tenouous.
>
> diff --git a/Doc/Zsh/options.yo b/Doc/Zsh/options.yo
> index f377539..b5e9100 100644
> --- a/Doc/Zsh/options.yo
> +++ b/Doc/Zsh/options.yo
> @@ -2098,6 +2098,12 @@ When it is unset, zsh allows expressions of the form tt($#)var(name)
>  to refer to the length of tt($)var(name), even for special variables,
>  for example in expressions such as tt($#-) and tt($#*).
>
> +Another difference is that with the option set assignment to an
> +unset variable in artihmetic context causes the variable to be created

Typo here on artihmetic. I would also put a comma after 'with the option set'?

-- 
Mikael Magnusson



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