zodiac sign calculator using bash script

0 votes

#!/usr/bin/bash
echo "This is a zodiac sign calculator"
echo "May i know your name"
read name
echo "May i know your month of birth"
read month
echo "May i know your date of birth"
read date

 if ([[ "$month" == "3" ] && [ "$date" -ge "21" ]] && [[ "$month" == "4" ] && [ "$date" -le "20" ]])
 then
   echo "Hi $name !!! Your Zodiac Sign is Aries!"

 elif ([[ "$month" == "4" ] && [ "$date" -ge "21" ]] && [[ "$month" == "5" ] && [ "$date" -le "21" ]])
 then
   echo "Hi $name !!! Your Zodiac sign is Taurus"

 elif ([[ "$month" == "5" ] && [ "$date" -ge "22" ]] && [[ "$month" == "6" ] && [ "$date" -le "22" ]])
 then
   echo "Hi $name !!! Your Zodiac sign is Gemini"

 elif ([[ "$month" == "6" ] && [ "$date" -ge "23" ]] && [[ "$month" == "7" ] && [ "$date" -le "23" ]])
 then
   echo "Hi $name !!! Your Zodiac is Cancer"

 elif ([[ "$month" == "7" ] && [ "$date" -ge "24" ]] && [[ "$month" == "8" ] && [ "$date" -le "23" ]])
 then
   echo "Hi $name !!! Your Zodiac sign is Leo"

 elif ([[ "$month" == "8" ] && [ "$date" -ge "24" ]] && [[ "$month" == "9" ] && [ "$date" -le "23" ]])
 then
   echo "Hi $name !!! Your Zodiac sign is Virgo"

 elif ([[ "$month" == "9" ] && [ "$date" -ge "24" ]] && [[ "$month" == "10" ] && [ "$date" -le "23" ]])
 then
   echo "Hi $name !!! Your Zodiac sign is Libra"

 elif ([[ "$month" == "10" ] && [ "$date" -ge "24" ]] && [[ "$month" == "11" ] && [ "$date" -le "22" ]])
 then
   echo "Hi $name !!! Your Zodiac sign is Scorpio"

 elif ([[ "$month" == "11" ] && [ "$date" -ge "24" ]] && [[ "$month" == "12" ] && [ "$date" -le "21" ]])
 then
   echo "Hi $name !!! Your Zodiac sign is Saguittarius"

 elif ([[ "$month" == "12" ] && [ "$date" -ge "22" ]] && [[ "$month" == "1" ] && [ "$date" -le "20" ]])
 then
   echo "Hi $name !!! Your Zodiac sign is Capricorn"
 elif ([[ "$month" == "1" ] && [ "$date" -ge "21" ]] && [[ "$month" == "2" ] && [ "$date" -le "19" ]])
 then
   echo "Hi $name !!! Your Zodiac sign is Aquarius"

 elif ([[ "$month" == "2" ] && [ "$date" -ge "20" ]] && [[ "$month" == "3" ] && [ "$date" -le "20" ]])
 then
   echo "Hi $name !!! Your Zodiac sign is Pieces"

 else
   echo "Incorrect Input!! Try Again!"
   fi

Guys please help me , i am stuck here ..its showing incorrect input everytime

Jun 22, 2022 in Linux Administration by Korak
• 5,820 points
514 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In Linux Administration

0 votes
0 answers

How do I run a program with commandline arguments using GDB within a Bash script?

When running a program on GDB, usually, ...READ MORE

Jun 21, 2022 in Linux Administration by Korak
• 5,820 points
717 views
0 votes
1 answer

How to take input from user in bash script?

You can use if-else branch to check ...READ MORE

answered Jan 31, 2019 in Linux Administration by Omkar
• 69,220 points
1,133 views
0 votes
2 answers

how to loop through the content of a file using bash

#!/bin/bash for i in  `cat peptides.txt` do echo $i done READ MORE

answered Sep 5, 2020 in Linux Administration by Prakash K. Aithal
2,980 views
0 votes
1 answer

redirecting stdout and stderr to file using bash

cmd >>file.txt 2>&1 Bash always executes and redirects ...READ MORE

answered Mar 19, 2019 in Linux Administration by ajs3033
• 7,300 points
22,305 views
0 votes
1 answer

How to send mail using linux shell script?

If you've already configured the server, with ...READ MORE

answered Jun 11, 2019 in Linux Administration by ajs3033
• 7,300 points
1,226 views
0 votes
1 answer

pipe to clipboard using Bash

Try xclip; xclip - command line interface to ...READ MORE

answered Jun 17, 2019 in Linux Administration by Shubham
• 13,490 points
877 views
0 votes
1 answer

Script file name in a Bash script

$0 will give you the complete basename. ...READ MORE

answered Jun 20, 2019 in Linux Administration by Shubham
• 13,490 points
762 views
0 votes
1 answer

Using shell variables in an awk script

Using -v is, imo, The best way because ...READ MORE

answered Jul 1, 2019 in Linux Administration by Shubham
• 13,490 points
2,682 views
0 votes
1 answer

copy and create destination directory using bash

mkdir -p "$d" && cp file "$d" try ...READ MORE

answered Jul 16, 2019 in Linux Administration by Upasana
• 8,620 points
894 views
0 votes
0 answers

Send private message to Discord user using bash and linux AT command

I'm running a Discord bot written in ...READ MORE

Apr 25, 2022 in Linux Administration by Edureka
• 13,690 points
1,251 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP