Ex1:
Ex2: Write a program let user to enter his name, age. Then, display his entered name and age.
Enter name: Long
Enter age: 19
Your name is Long and you are 19 year old.
Ex3: Enter an integer n
If n > 0 display “Positive number”
If n < 0 display “Negative number”
If n == 0 display “Zero”
Ex4: Code a program named doCal.sh so you can pass 3 parameters to this program. The program
will calculate the result as following and show it in the screen.
/bin/sh doCal.sh 8 3 4
Result 1 is (8+3+4) = 15
Result 2 is (8+3)*(8-3)*4*4 = 880
/bin/sh doOpt.sh 2 3
You must input 3 numbers to do this operator!
Ex5:
Write a shell script to find the sum, the average and the product of the four integers entered.
Ex6:
Write a shell script to ask user that he want to know about month or year? Then display the result in
number.
What do you want to know?
Enter: month
Day of month is 20