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

How can I add a seperate action listener to all 14 of my buttons at once that can determine player turn?(java) -

php - Sorting an multidimension array using usort fails -

Simple file compression in C -