SHELL PROGRAMMING LAB QUESTION PAPER
PART A - Question 1
Write a shell script to swap 2 values.
PART B - Question 9
Write a shell script that takes two file-names as arguments. It should check whether the contents of two files are
same or not, if they are same then second file should be deleted.
PART A - Question 2
Write a shell script to check if the given number is even or odd.
PART B - Question 8
Write a C program to display PID of parent and PID of child process.
PART A - Question 3
Write a shell script to find the largest of 3 numbers.
PART B - Question 7
Write a shell script to display: a) Version of the shell b) The user information c) Login date and time d) List of
processes running on the system e) User home directory.
PART A - Question 4
Write a shell script to perform arithmetic operations.
PART B - Question 5
Write a shell script to extract a sub string from a given string.
PART A - Question 5
Write a shell script to find the sum of first 10 natural numbers.
PART B - Question 4
Develop an interactive script that asks for a word and file name and then tells how many times that word occurred
in the file.
PART A - Question 6
Write a shell script to display multiplication table of a given number.
PART B - Question 3
Write a shell script that displays a list of all files in the current directory to which the user has read write and
execute permissions.
PART A - Question 7
Write a shell script to find the length of a given string.
PART B - Question 2
Write a shell script to calculate the TA, HRA and DA of an employee.
PART A - Question 8
Write a shell script to find factorial of a given number.
PART B - Question 1
Write a shell script to search for particular element from an array of elements.
PART A - Question 9
Write a shell script which counts the numbers of lines and number of words present in a given file.
PART B - Question 9
Write a shell script that takes two file-names as arguments. It should check whether the contents of two files are
same or not, if they are same then second file should be deleted.
PART A - Question 10
Write a shell script to display the Fibonacci series up to N number.
PART B - Question 8
Write a C program to display PID of parent and PID of child process.