LABORATORY-2
Shell-Scripting
All 18 Shell Scripts in one page
Jump To Solutions
Laboratory - Questions(18)
Question-1.
Write a menu driven shell script for the following options:
(i) Merging the contents of two files into another.
(ii) Searching a pattern from a file.
If the user gives some invalid choice, it will prompt “Invalid option” message.
Question-2.
Write a shell script to check whether a given string is palindrome or not.
Question-3.
Write a shell script that will display some desired number of lines starting from a specified line of a given file. User must interactively supply the file name, starting line number and number of lines to be displayed.
Question-4.
Write a menu driven shell script for the following options:
(i) Number of presently active users
(ii) Displaying some desired number of lines from top of a file.
(iii) Updating the access time of a given file to current time.
(iv) If the user gives some invalid choice it will prompt “Invalid option” message.
Question-5.
Write a shell script to sort some given numbers in descending order.
Question-6.
Write a shell script to find the maximum and minimum of some given numbers.
Question-7.
Write a shell script to create two infinite processes in background and then prematurely terminate each of these infinite processes.
Question-8.
Write a shell script to implement Bubble Sort. Print the contents of the sorted array without using any loop.
Question-9.
Write a shell script to delete an element from a specific position of an array
Question-10.
Create a file that contains the ROLL NUMBER, NAME, CITY of students of a class in sorted order with respect to Roll Number.
Now write a menu driven shell script that has the following options:
a. Display the contents of whole file.
b. Display the information of a student with specific Roll Number supplied by the User.
c. Delete the entry of a student from the file with a specific Roll Number supplied by User.
d. Add a new entry in the file.
e. Update an entry of a student with a specific Roll Number supplied by the User.
Question-11.
Write a shell script to check for an Armstrong number.
Question-12.
Write a shell script to print all possible combinations of 3 numbers.
Question-13.
Write a shell program to find the position of substring in given string.
Question-14.
Write a shell program to find the gcd for the 2 given numbers.
Question-15.
Write a shell program to count number of words, characters, white spaces and special symbols in a given text
Question-16.
Write a shell program to find factorial of given number.
Question-17.
Write shell script to generate fibonacci series upto "n"
Question-18.
Write a shell script to sort the given numbers in descending order using Bubble sort.
Solutions:
Click the button below to get solution
Codes