FANDOM


Without conditional statements, your script will only follow a fixed process. Intereacting with the user would be almost of no use. Let's see how we can input them!

IntroductionEdit

We have used a conditional statement before (in all scripts, actually):

if [ "$PLAYONLINUX" = "" ]
then
    exit 0
fi

If the condition is true, the code between then and fi will be executed.

SyntaxEdit

The condition is put in square brackets. The code to be executed if the condition is true is put between then and fi.

Note: Do not run this code.

if [ condition ]
then
code
fi
Community content is available under CC-BY-SA unless otherwise noted.