|
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[$((${#arr[@]}-1))]} three If there is not currently a friendlier syntax for this, might I suggest: ${arr[-1]} -- Poor Yorick
[Prev in Thread] | Current Thread | [Next in Thread] |