Quantcast
Channel: How do I check if variable is an array? - Stack Overflow
Viewing all articles
Browse latest Browse all 10

How do I check if variable is an array?

$
0
0

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  fidone

How do I do it?


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images