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) -

c# - passing input text from view to contoller with FacebookContext using Facebook app -

Calling a C++ function from C# by passing a string with variable size to it -