mercredi 15 juillet 2020

Spacing and newlines in bash

What is the reason why the following fails:

if [ 'asdf' == 'eff' ] then
    echo You may go to the party.
else
    echo You may not go to the party.
fi

But the following is OK:

if [ 'asdf' == 'eff' ]
then
    echo You may go to the party.
else
    echo You may not go to the party.
fi

Does then have to be on its own line or what are the spacing/newline requirements for it?

Aucun commentaire:

Enregistrer un commentaire