help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] declare -i


From: Bill Gradwohl
Subject: Re: [Help-bash] declare -i
Date: Wed, 9 May 2012 19:18:51 -0600

On Wed, May 9, 2012 at 2:55 PM, Greg Wooledge <address@hidden> wrote:
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

Didn't know that you could write a=b b=c c=d d=e e=f f=42; as one statement. I'll have to play with that to figure out who sets the return code (last I presume), and if there's an assumed connector in between each _expression_. Is there any return code checking from one to the next? I'll figure it out.

Didn't know about the infinite recursive expansion either.

Thank You

The infinite recursion could come in handy in a non arithmetic context as well. Why can't we have it everywhere?

This brings to mind what happened the other day.  I tried array[-1]=blahBlah and couldn't figure out what it was complaining about. A Google search finally told me that's illegal on the left hand side. I guess I never tried that before. I didn't notice anything in man bash about it.

I'd like the infinite recursion everywhere and [-1] on the left hand side as examples of consistency as opposed to the exceptions they are currently.

--
Bill Gradwohl


reply via email to

[Prev in Thread] Current Thread [Next in Thread]