[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] declare -i
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] declare -i |
Date: |
Wed, 9 May 2012 16:55:03 -0400 |
User-agent: |
Mutt/1.4.2.3i |
On Wed, May 09, 2012 at 02:43:31PM -0600, Bill Gradwohl wrote:
> Nope. Wasn't aware of it. Thank You for the education.
Math contexts do an infinitely-recursing indirect parameter expansion
thingy:
imadev:~$ a=b b=c c=d d=e e=f f=42; echo $((a))
42
And there seems to be a weird difference between these two that I don't
fully understand:
(with a, b, c, d, e, f still defined as above)
imadev:~$ unset x
imadev:~$ declare -i -a x=(a); echo "$x"
a
imadev:~$ unset x
imadev:~$ declare -i -a x; x=(a); echo "$x"
42
Based on the previous messages in this thread, I guess this happens
because in the first one, the (a) is evaluated as a list of strings
(since the evaluation occurs before the array has been made "-i"??),
while in the second one, (a) is evaluated as a list of math contexts,
since it's being assigned to a "-i" array. I could be mistaken.
- [Help-bash] declare -i, Bill Gradwohl, 2012/05/08
- Re: [Help-bash] declare -i, Dan Douglas, 2012/05/09
- Re: [Help-bash] declare -i, Bill Gradwohl, 2012/05/09
- Re: [Help-bash] declare -i, Bill Gradwohl, 2012/05/09
- Re: [Help-bash] declare -i, Chet Ramey, 2012/05/09
- Re: [Help-bash] declare -i, Bill Gradwohl, 2012/05/09
- Re: [Help-bash] declare -i, Greg Wooledge, 2012/05/09
- Re: [Help-bash] declare -i, Bill Gradwohl, 2012/05/09
- Re: [Help-bash] declare -i, DJ Mills, 2012/05/09
- Re: [Help-bash] declare -i,
Greg Wooledge <=
- Re: [Help-bash] declare -i, Chet Ramey, 2012/05/09
- Re: [Help-bash] declare -i, Bill Gradwohl, 2012/05/09
- Re: [Help-bash] declare -i, Dan Douglas, 2012/05/09
- Re: [Help-bash] declare -i, Greg Wooledge, 2012/05/10
- Re: [Help-bash] declare -i, Bill Gradwohl, 2012/05/10
- Re: [Help-bash] declare -i, Chet Ramey, 2012/05/10
- Re: [Help-bash] declare -i, Greg Wooledge, 2012/05/10
- Re: [Help-bash] declare -i, Chet Ramey, 2012/05/10
- Re: [Help-bash] declare -i, Dan Douglas, 2012/05/10
- Re: [Help-bash] declare -i, Bill Gradwohl, 2012/05/10