Re: last element of an array

2007-05-24 Thread Poor Yorick
> > > > If there is not currently a friendlier syntax for this, might I suggest: > > > > ${arr[-1]} > > What's wrong with echo [EMAIL PROTECTED]: -1} ? > I assume this syntax is new since 2.05b.01(1), which is what I currently have access to. I did check the latest "what's new" before

Re: last element of an array

2007-05-24 Thread Andreas Schwab
"Poor Yorick" <[EMAIL PROTECTED]> writes: > The syntax I'm currently using to access the last element of an array looks a > little evil: > >>arr=( one two three ) >>echo ${arr[$(([EMAIL PROTECTED]))]} At least you can leave out the $((...)) construct, this is implicit. Andreas. -- Andreas Sch

Re: last element of an array

2007-05-24 Thread Chet Ramey
Poor Yorick wrote: > The syntax I'm currently using to access the last element of an array looks a > little evil: > >> arr=( one two three ) >> echo ${arr[$(([EMAIL PROTECTED]))]} > three > > If there is not currently a friendlier syntax for this, might I suggest: > > ${arr[-1]} What's wrong w