" +=" operator does string concatenation for integer variables
Bug #1857702 reported by
jvdh
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mksh |
Fix Released
|
Wishlist
|
Unassigned |
Bug Description
consider
typeset -i x=0; x+=1; echo $x # → 1 (as in ksh/bash/zsh)
but
typeset -i x=1; x+=1; echo $x # → 11 (rather than 2 as in the other shells)
I believe mksh should honour the integer declaration and interpret `+=' accordingly. currently, it does not even consistently use string concatentation (since the first example does not yield `01' ...).
Changed in mksh: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
Erm… that’s right, += is string concatenation.
Write “let” before the line to make it integer addition.