Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
21 views6 pages

Lab3 OSG

Uploaded by

kaitoraisen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views6 pages

Lab3 OSG

Uploaded by

kaitoraisen
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

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

You might also like