bash - Shell script - Giving error while iterating through array -


I'm trying to check if condition on a name value in the defined array. I'm experiencing this error:

  main.sh: line 9: [10.247.78.207: command not found main.sh: line 9: [10.247.78.207: command not found < / code>  

This is my code:

  #! / Bin / bash declared - a name = $ {name :-( 10.247.78.207 10.247.78.206}} for ((I = 0; i <$ name # {@}}; i ++)) "[$ {Name {0}}" == "10.247.78.207"] Then echo "hello" files    

change ["$ {names [0]}" == "10.247.78.207"] to ["$ {name [0]}" = = "10.247.78.207"] . This is the place after [ and before ] . Hope this solves your problem.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -