My very-frank suggestion to you is ...
bash-scripting is highly over-rated!
I mean... let's get
serious here. You're working in an environment that probably has at least three very-good full fledged programming-environments pre-installed and ready to go: Perl, Python, and PHP. Maybe even Ruby.
Any of those systems can be used to run your program, by the trivially-simple expedient of "shebang" ...
#!command_name ... and the person (or the program) who's running your program will therefore neither know nor care.
In other words ... "if you're monkeying-around too much with bash-scripting,
you're missing the point."
You have "a preponderance of riches." Deal with it.
"Bash" is intended to be ... a
shell. Nothing more, nothing less. As such, it has a modicum of simple scripting-capabilities, mostly to let you specify slightly-complex things if-and-when you want to. But did "Bash" ever set out to be a programming language? No... why should it?
Bash is a shell...
Perl|PHP|Python|Ruby is a language.
... And you have equal and unlimited access to
all of them.
Plan accordingly.