question archive Ok, so i am basically stuck on a programs on linux who doesn't respond  the way in the way that i will like it to respond

Ok, so i am basically stuck on a programs on linux who doesn't respond  the way in the way that i will like it to respond

Subject:Computer SciencePrice:9.82 Bought3

Ok, so i am basically stuck on a programs on linux who doesn't respond  the way in the way that i will like it to respond. First, here is the question:

  1. Your code should work for any combination of upper and lowercase letters that the user enters for any of the input for the first question.  For example, yes, Yes, YeS, yES, YES, YEs, etc should all work for any input.
  2. Ask the user if you can ask them a question.  If they do not answer yes or no keep asking until they do answer yes or no.
  3. If they answer no, print an appropriate message and exit.
  4. If they answer yes, ask "What is your favorite day of the week?"  These answers should be case sensitive and require the first letter to be capitalized.
    • If they answer Friday print "Really? Most people still have to work on Friday."
    • If they answer Saturday print "You and everyone else."
    • If they answer Sunday print "I have Monday anxiety on Sunday."
    • If they answer Monday print "What kind of weirdo are you?"
  • If they answer anything else print a message that includes the day they gave.  For example, if they enter Tuesday it could print "Tuesday, who likes Tuesday?"  You should not hard code Tuesday/Wednesday/Thursday  in the script.  Those days should all run the same code and be processed by the part of the code that gets run when none of the other answers match.
  1. Any input is fine for the second question, but it cannot be blank.  It doesn't even have to be a day of the week.  That makes no sense in this context, but I am not making you validate that input to be a day of the week.

Basically, i am stuck at the part 4 where it ask to be case sensitive and give a specific output. The way by which i am doing obligatory which means i need use (case and esac); however the output of my programs doesn't give the expected result. 

28368464

Result output:

[]$ ./_day.sh
Bonjour, can i ask you a question?yes
What is your favorite day of the week?
, who likes .
[]$ ./_day.sh
Bonjour, can i ask you a question?yes
What is your favorite day of the week?
Wednesday
, who likes .
[]$ vi _day.sh
[]$ ./_day.sh
Bonjour, can i ask you a question?
Heuh escuse me,I SAID:CAN I ASK YOU  A QUESTION?! (you have to respond yes or no                                                         )TUesday
Heuh escuse me,I SAID:CAN I ASK YOU  A QUESTION?! (you have to respond yes or no                                                         )yes
What is your favorite day of the week?
TUesday
, who likes .
 

 

 

 

Please, i know it's tempting to simply use another way to finish this programs, but i need to know how to solve it using the case-statement method.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

The problem in your code is that you are using "or" which is the linux equivalent of the logical OR operator in C. Linux' OR operator evaluates both arguments and then returns the value to be 0. You should be using something like eq or neq instead of or.
Since we already know what the answer will be (because you have set up your conditions with if commands, and you did not check for an empty string) all that I need you to do is print something out when any input matches those conditions (yes, yEs, YES, YEs, etc).
Try making these changes:
Your code should work for any combination of upper and lowercase letters that the user enters for any of the first input questions.

Step-by-step explanation

For example, yes, Yes, YeS, yES, YES, YEs, etc should all work for any input.
Ok. How to do the changes:
(case and esac are the same thing here)