mercredi 11 mars 2020

Syntax error in my bash script conditional

I am new to bash and still learning the syntax. I am receiving an error:

test.sh: 5: Syntax error: word unexpected (expecting ")")

test.sh:

#!/bin/bash

adr=${1:-'whoami'}
var1=$(ping -c3 $4 | tail -n2)
if [ (echo $var1 | cut -d " " -f6) == "0%" ]
then
        echo "Ping successful"
else ...

(The ... represents the rest of my complete code) I believe it is in this block of code. What am I missing here?

Aucun commentaire:

Enregistrer un commentaire