I have spent a bit of time playing around with
bash
functions to manipulate arrays.
There are functions that treat an array as a stack
(e.g. pop and push);
functions to add and remove any element; functions to move
elements around, etc..
The important feature of these functions is that they are always passed the names of one or more arrays, never their elements.
They are also fully self-contained. Any function can be copied into a script without having to worry about dependencies.
The functions haven't been thoroughly tested (there's a framework for a test suite here), and they should have more documentation. I'd like to add some examples, but I don't know whether I'll spend any more time on either the functions or this section of my website.
The function library is released under the GNU General Public Licence.
Please leave comments on my blog.