![]() |
|
#1
|
|||
|
|||
Writing simple script in LinuxHello,
I am trying to write a simple script in Linux that will choose one of the options from the menu(add, subtract, mulitply, divide), and do one of the operations... I do not know exactly where to put the options for the input of the numbers...i think that is the part that is messing up the script... here is what i have: #!/bin/sh clear echo "M To do Multiplication" echo "D To do Division" echo "Q To quit" read option while [ $option != Q] echo "Please enter a number" read num1 echo "Please enter another number" read num2 do case $option in A) echo "THe sum of $num1 and $num2 is: `expr $num1 + $num2`";; S) echo "The difference of $num1 and $num2 is: `expr $num1 - $num2`";; M) echo "$num1 multiplied by $num2 is: `expr $num1 * $num2`";; D) echo "$num1 divded by $num2 is: `expr $num1 / $num2`";; *) echo "That was an invalid selection";; esac while [option = Q] do exit echo "Good Bye" __________________________________________________ ____________ |
|
#2
|
|||
|
|||
Re: Writing simple script in LinuxQuote:
The while construct is Code:
So your bash script could look something like Code:
Regards, Dave |
Recent GIDBlog
Toyota - 2008 July Promotion by Nihal
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How To Remove Linux And Install Windows? | rockaway | Computer Software Forum - Windows | 3 | 06-Mar-2008 21:00 |
| Need Free Website Templates | sam_dezine | Web Design Forum | 8 | 06-Sep-2006 03:25 |
| Pixel script Template customization | gatufats | Web Design Forum | 2 | 29-Jun-2006 04:05 |
| Who Is A Web Designer ? | alicehopkins | Web Design Forum | 1 | 13-Jun-2006 02:56 |
| HTML Code | amgujral | Web Design Forum | 0 | 07-Apr-2006 09:46 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The