0% found this document useful (0 votes)
16 views15 pages

Am - En.u4cse22233 Os Lab3

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

Am - En.u4cse22233 Os Lab3

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

K.

Rushikesh Reddy
AM.EN.U4CSE22233

Operating Systems LabSheet 3

1. Write shell scripts for the following:

a. To take your name, programme name and enrolment number as


input from user
and print it on the screen.
b. To find the sum, the average and the product of four integers.
c. Write a program to check whether a number is even or odd.
d. To exchange the values of two variables.
e. To find the lines containing a number in a file.
f. To concatenate two strings and find the length of the resultant
string.
g. To concatenate the contents of two files.

1a)
1b)

1c)
1d)

1e)
1f)

1g)
1h)
2. The length and breadth of a rectangle and radius of a circle are
provided as user input. Write a shell script that will calculate the area
and perimeter of the rectangle and the area and circumference of the
circle.
3. Write a menu driven shell program to read two numbers and print the
results of all the arithmetic operations. ( + , - , * , / , % , ++ , -- )
4. Write two separate shell scripts to find the factorial of a number using
while statement and for statement.
4b)

5. Given a file of numbers (one number per line), write a shell script that
will find the lowest and highest number.
6. Write a shell program to read n numbers into an array and display the
average of them.
7. Write a shell program to print the following Patterns.

7b)
8. Write a shell program to read two matrices, add them and print the
output matrix.
9. Write a program to read a matrix and print the transpose of it.
10. Run the program cal.sh given to you

You might also like