0

Whenever I run this code I get a bunch of errors and it automatically skips to the else statement and I have no idea why. Any advice is appreciated.

#! /bin/bash

echo "Enter a number between 1 and 100: "
read num1
echo "The number you entered was:" $num1

if [$num1 -lt 18 ] && [$num1 -gt 0 ]
then
    echo "You are too young to vote or drink."

elif [$num1 -gt 65 ]
then
    echo "You qualify for the senior discount."

elif [$num1 -ge 18 ] && [$num1 -lt 21 ]
then
    echo "You can vote but not drink."

elif [$num1 -ge 21 ] && [$num1 -lt 65 ]
then
    echo "You can vote and drink but do not qualify for a senior discount."

else
    echo "The number you have enter is invalid."
fi
echo ""
Jesse Hix
  • 21
  • 2

0 Answers0