Bash Scripting - Arrays
Identify the error in this bash script snippet that tries to print the number of elements in array
data:data=(1 2 3 4)
echo ${#data}data:data=(1 2 3 4)
echo ${#data}${#data} returns the length of the first element (string length), not the number of elements.${#data[@]} to get the count of elements in the array.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions