mercredi 13 février 2019

What is the syntax error in this if statement?

I wrote a script in wich a function check the correspondence of the login hostname with the one expected by the script.

This is the piece of code generating the error:

function existS() {
 local  HERE
 $HERE=$(hostname)
 if [ $HERE != $1 ]
    than
        echo "You selected a direction from $1 but you are logged on $HERE not on $1"
        exit 1
 fi
}

When I run the script I get a "syntax error near unexpected token `fi'".

What is the syntax error?

Aucun commentaire:

Enregistrer un commentaire