mardi 27 juin 2017

Bash script greater than operator gives syntax error

I googled a lot and found it because of the spaces within the if condition but then even after resolving that, it still gives me some errors as I've pasted below. Just beginning to learn bash scripts any help would be useful. Thanks.

#!/bin/bash
msg=3;
if[ $msg -gt 0 ]
then
echo $msg;
fi

ERROR

line 3: if[ 3 -gt 0 ]: command not found
line 4: syntax error near unexpected token `then'
line 4: `then'

Aucun commentaire:

Enregistrer un commentaire