On Tue, Nov 24, 2020 at 12:07 AM Jetzer, Bill
wrote:
> ((--x)) || echo "err code $? on --x going
> from $i to $x";
>
> err code 1 on ++x going from -1 to 0
>
That's not about --x, but of the ((...)) construct:
"" (( expression ))
The arithmetic expression is eval
Should variables automatically created within arithmetic constructs have
the integer flag implied?
unset x; ((x = 42)); typeset -p x
> declare -- x="42"
Should it be:
declare -i x="42"
Here are cases where that would make a difference:
unset x; ((x = 42)); x+=624; typeset -p x
> declare --
On Tue, Nov 24, 2020 at 02:30:36PM +0100, Léa Gris wrote:
> Should variables automatically created within arithmetic constructs have the
> integer flag implied?
No. Please, no. It's bad enough that the -i flag exists in the first
place, without it being randomly added to poor innocent variables.
Thank you for the clarification. I understand now.
--bill
From: Ilkka Virta
Sent: Tuesday, November 24, 2020 2:08 AM
To: Jetzer, Bill
Cc: bug-bash@gnu.org
Subject: Re: increment & decrement error when variable is 0
On Tue, Nov 24, 2020 at 12:07 AM Jetzer, Bill
mailto:jetz...@svaconsulting.co
Can we validly write a line
unset local a b c d e f g h i
to mean: local a b c d e f g h i;unset a b c d e f g h i
if yes, how come local=9 is valid variable 'local' normally ? thanks much
> On Nov 24, 2020, at 8:06 PM, Budi wrote:
>
> Can we validly write a line
>
> unset local a b c d e f g h i
>
> to mean: local a b c d e f g h i;unset a b c d e f g h i
No. Have you looked at the documentation for "unset"?
vq
P.S. Again, not a bug. Not appropriate for bug-bash.