There is a difference in the output of commands that I don't understand, as stated below:
INPUT="$@"
echo "$INPUT ${#INPUT} ${#INPUT[@]} ${#@}"
# outputs: a b c 5 1 3
arr=(a b c)
echo "$arr ${#arr} ${#arr[@]}"
# outputs: a 1 3
I run a script with ./my_script.sh a b c.
I understand that echo "$arr" is dereferencing $arr to the first element, and then printing a. At the same time for the command $INPUT it prints a b c.
For the command ${#INPUT} and ${#INPUT[@]} why is the output 5 and 1 respectively. Shouldn't it be similar to output of the commands ${#arr} and ${#arr[@]}?