I have two arrays:
arrayA=(1 2 3)
arrayB=(a b c)
and I want to print out one of them using a command line argument, i.e., without any if else
.
I tried a few variations on the syntax with no success. I am wanting to do something like this:
ARG="$1"
echo ${array${ARG}[@]}
but I get a "bad substitution" error. How can I achieve this?
Best Answer
Try doing this :
NOTE
man bash
(parameter expansion) :