mercredi 6 mai 2015

checking arguments in a shell script

I'm having a surprising large amount of trouble finding a guide on this.

what's wrong with this shell script:

if ["$1" == "-t"]
then
        echo "t"
elif ["$1" == "-r"]
then
        echo "r"
fi

It's supposed to be a very simple test. if the argument is -t, do one thing, if it's -r do the other.

Aucun commentaire:

Enregistrer un commentaire