Bash puzzle: Unset last element of an array...
Here is a puzzle for bash lovers. This is taken from shell scripting community at Orkut.
Question: How to reset last element of an array even if it’s a discontinuous array.
Answer:
$ array=([0]=a [9]=d [2]=i [6]=k); echo "${array[@]}"
a i k d
$ : ${!array[@]}
$ unset array[_]
$ echo "${array[@]}"
a i k
If you are not familiar with bash, you might...
