lundi 29 novembre 2021

how to check the ip adress with a yaml file

I would like to check an ip-adress with a yaml-file. Unfortunately I got some syntax errors when trying to run following code:

script:
    - echo "Checking if PXI-Testsystem is running.."
    - |
      exit_code=0
      if [ ping -n 1 10.54.10.10 | grep -q "ms" ]; then
        echo "FOUND"
        exit_code=$?
      else 
        echo "NOT FOUND" 
        exit_code=$?       
      fi

I get this error:

+ if [ ping -n 1 10.54.10.10 | grep -q "ms" ]; then
+   ~
Missing '(' after 'if' in if statement.

What is wrong with the syntax here?

Thanks in advance

Aucun commentaire:

Enregistrer un commentaire