I'm new to bash and I'm trying to write a script that will prompt the user to select a number, and open the corresponding file. Right now i just wanted to get the options to work properly but I get the error:
./filescript: line 7: syntax error near unexpected token `elif'
./filescript: line 7: `elif [[$server == 2]]'
Anytime I try to make a selection when it's ran. Here's what I have, any advice is appreciated!
#!/bin/bash
echo "Which file would you like to open: "
read input
if [[$input == 1]] then
echo "This is the first option"
elif [[$input == 2]]
echo "This is the second option"
else
echo "Error"
fi
Aucun commentaire:
Enregistrer un commentaire