syntax error near Unexpected token `fi'

Asked

Viewed 91 times

1

I’m new and I’m having trouble with the script below:

echo "Enter an A, B or C"
read letter

if [[ $letter == "A" || $letter == "a" ]];
then
    echo  "this is A"
elif
    [[ $input == "B" || $input == "b" ];
then
    echo "this is B"
elif
   [ $input == "C" || $input == "c" ];
    echo "this is C"
set -x
fi

error: syntax error near Unexpected token `fi'

  • Why the last elif doesn’t have a then?

  • lack the then at last elif or replace by else

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.