LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help with 'CASE' (https://www.linuxquestions.org/questions/linux-newbie-8/help-with-case-4175540610/)

šprincMehi 04-24-2015 06:49 AM

Help with 'CASE'
 
Hi guys,

i'm beginner with Unix, I tried my best, but I Really don't know how to finish it .

here's my problem : I have to do something like Student system - student's name | subjects | mark |credits.

after starting script it will ask you for Student's name, then which subject, then the mark will appear.

It's a homework, and I have my own idea how to solve it, but cannot finish it, i don't want complete solution, just a help!

Code:

#!/bin/bash
echo "Students name"
echo -n "Enter student's name: "
read name
echo
case $name in
Example1|Math) echo "C" ;;
Example2|Programming) echo "D" ;;
Example3|WWW) echo "A" ;;
Example4|Economie) echo "-" ;;
esac

I don't now how to bring together case with second things which is "enter subject".

I appreciate any help

jpollard 04-24-2015 07:27 AM

You repeat the structure you already have... You have to prompt and read the reply.


All times are GMT -5. The time now is 02:12 AM.