bug-bash
[Top][All Lists]
Advanced

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

last element of an array


From: Poor Yorick
Subject: last element of an array
Date: Thu, 24 May 2007 14:19:34 +0000

The syntax I'm currently using to access the last element of an array looks a 
little evil:

>arr=( one two three )
>echo ${arr[$((address@hidden))]}
three

If there is not currently a friendlier syntax for this, might I suggest:

${arr[-1]}

-- 
Poor Yorick




reply via email to

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