-1

I am new to bash and I found out a command called cal in a bash tutorial and want to test it with if

here is the code:

    echo "What is your name?"
read PERSON
echo "Hello, $PERSON"
echo "Do you want to know the date?"
read CALENDAR
if [[ CALENDAR == "yes" ]]; then
  cal
else
  echo "Bye"
fi

so can you help me? when I run it shows :

 bash main.sh
What is your name?
Tony #I input
Hello, Tony
Do you want to know the date?
yes #Also I input this
Bye

And I'm also new I don't know bash but I know Python so don't tell me if I used python in bash

PLEASE help me run it. You can run this if you want in Replit

1 Answers1

0
echo "What is your name?"
read PERSON
echo "Hello, $PERSON"
echo "Do you want to know the date?"
read CALENDAR
if [[ $CALENDAR == "yes" ]]; then
  cal
else
  echo "Bye"
fi

It should be if $var == "yes"

Aven Desta
  • 2,114
  • 12
  • 27