Shell Script (VI Editior)

You might also like

Download as odt, pdf, or txt
Download as odt, pdf, or txt
You are on page 1of 10

MCA 1 st SEMESTER - 2022

Assignment – 4

Allotment Date: 24/02/2022 Submission Date: 04/03/2022


------------------------------------------------------------------------------------------------------------------------
Q1- Write a shell script to read three sides of a triangle and check whether they will form a valid
triangle or not. For a valid triangle, the sum of any two sides must be greater than third one.
Solution:-

Shell Script ( VI Editior )

Output Screenshort
Q2- Write a shell script to read three numbers using command line arguments and print the largest
number. If you don’t input any number or more than three numbers, then display an error message
to execute the script correctly.
Solution:-

Shell Script ( VI Editior )

Output Screenshort
Q3- Write a shell script to read a number using command line and reverse it. If you
don’t input any number or more than one numbers, then display an error message to
execute the script correctly.
Solution:-

Shell Script ( VI Editior )

Output Screenshort
Q4- Write a shell script to read a positive number and count total number of digits. In
case of negative number is given as input, display print error message.
Solution:-

Shell Script ( VI Editior )

Output Screenshort
Q5- Write a shell script to read a file and change the read and write permission of the
file to read, write and execute permission for all.
Solution:-

Shell Script ( VI Editior )

Output Screenshort
Q6- Write a shell script to read a number and check whether it is Prime Number or
not.

Solution:-

Shell Script ( VI Editior )

Output Screenshort
Q7- Write a shell script to read a three digit number and check whether it is
Armstrong Number or not.
Solution:-

Shell Script ( VI Editior )

Output Screenshort
Q8- Write a shell script to input basic salary of an employee and calculate gross
salary according to given conditions.
Basic Salary <= 10000 : HRA = 20%, DA = 80%
Basic Salary is between 10001 to 20000 : HRA = 25%, DA = 90%
Basic Salary >= 20001 : HRA = 30%, DA = 95%
Solution:-

Shell Script ( VI Editior )

Output Screenshort
Q9- Write a shell script to read a number and check whether it is palindrome number
or not.
Solution:-

Shell Script ( VI Editior )

Output Screenshort
Q10- Write a shell script to print value of power of a number. Read base and
exponent from user.
Solution:-

Shell Script ( VI Editior )

Output Screenshort

You might also like