What am I missing here?
I have created a simple array:
declare -a appArray=(
"item1 -a -b"
"item2 -c -d"
)
If I echo this I can see it all
echo ${appArray[@]}
> item1 -a -b item2 -c -d
I then create a function as follows:
fc_DEBUG () {
if [ $1 -eq 1 ] ; then
echo $2;
fi;
};
It is designed to sit in a bash script, and if I set a DEBUG variable it will echo the text back. So I can use it throughout the script without needing to manually add / remove things.
It works fine with basic data: e.g
fc_DEBUG $DEBUG "This is DEBUG text"
If I call this with the Array however, I only get a part of the Array.
fc_DEBUG $DEBUG "${appArray[@]}"
> item1 -a -b