jeudi 22 septembre 2016

trying to validate text input with bash

I'm tryong to validate a simple text input. I need to validate the the input is Either Yes or NO. I'm using the following code:

#!/bin/bash
IsSSL=$1
if [$IsSSL = "Yes"] || [$IsSSL = "No"];
then 
        echo "correct input"
else
        echo "incorrect input"
fi

but I keep getting the following errors:

#sh test.sh df
test.sh: line 3: [df: command not found
test.sh: line 3: [df: command not found
incorrect input

Any idea what am I doing wrong?

Aucun commentaire:

Enregistrer un commentaire