I am trying to assign an array length to a variable.
servers=(apple orange) len = ${#servers[@]}
it says len command not found. why?
You can't have spaces between your variable name and the assignment operator =. If you do it will treat the variable name as a command.
=
Try:
len=${#servers[@]}
1.4m articles
1.4m replys
5 comments
57.0k users