I have a loop over variable names and I need to check if content of a variable is an array or not:
for varname in AA BB CC; do local val if [ "$varname" is array ]; then # how can I perform this test? echo do something with an array else echo do something with a "'normal'" variable fi done
How do I do it?
Google may be your friend:
declare -p variable-name 2> /dev/null | grep -q '^declare -a'
1.4m articles
1.4m replys
5 comments
57.0k users