0% found this document useful (0 votes)
120 views

Unix Programming Lab

The document provides a list of 30 programming tasks to be completed in a Unix programming lab, ranging from writing shell scripts that search files, perform calculations, and manage files/directories, to scripts that prompt users for input and check for passwords. It also outlines an examination scheme for the lab with different components like lab tests, practicals, attendance, and an end exam making up the total weightage.

Uploaded by

Sandeep Kushwaha
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views

Unix Programming Lab

The document provides a list of 30 programming tasks to be completed in a Unix programming lab, ranging from writing shell scripts that search files, perform calculations, and manage files/directories, to scripts that prompt users for input and check for passwords. It also outlines an examination scheme for the lab with different components like lab tests, practicals, attendance, and an end exam making up the total weightage.

Uploaded by

Sandeep Kushwaha
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

UNIX PROGRAMMING LAB

List of Unix Programmes


1. Write a Shell Script that takes a search string and filename from the terminal & displays the results. 2. Write a Shell Script that takes pattern and filename as command line arguments and displays the results appropriately i.e. pattern found/pattern not found. 3. Write a Shell Script that accepts only three arguments from the command line. The first argument is the pattern string, the second argument is the filename in which the pattern is to be searches and the third argument is the filename in which the result is to be stored. 4. Write a Shell Script that accepts a filename as a command line argument and finds out if its a regular file or a directory. If its a regular file, then performs various tests to see if it is readable, writeable, executable etc. 5. Write a Shell Script which creates the following menu and prompts for choice from user and runs the chosen command. Today's date Process of user List of files Quit to UNIX 6. Write a Shell Script that computes the factorial of a given number 7. Write a Shell Script that works like a calendar reminding the user of certain things depending on the day of the week. 8. Write a Shell Script that changes the extension of a group of files from txt to doc 9. Write a Shell Script that accepts both filename and a set of patterns as positional parameters to a script. 10. Write a Shell Script which will redirect the output of the date command without the time into a file. 11. Write a Shell Script (using while loop) to execute endlessly (until terminated by user) a loop which displays contents of current directory, disk space status, sleep for 30 seconds and display the users currently logged in on the screen. 12. Write a Shell Script that receives two filenames as arguments. It should check whether content of the two files is same or not. If they are same, second file should be deleted. 13. If a number is input through the keyboard, WASS to calculate sum of its digits. 14. Write a Shell Script that performs a count-down either from 10 (default) or from the value that is entered by the user. 15. Write a Shell Script which takes a command line argument of Kms and by default converts that number into meters. Also provide options to convert km to dm and km to cm. 16. Write a Shell Script using for loop, which displays the message "Welcome to the UNIX System" 17. Write a Shell Script to change the filename of all files in a directory from lower-case to upper-case. 18. Write a Shell Script that examines each file in the current directory. Files whose names end in old are moved to a directory named old files and files whose names end in .c are moved to directory named cprograms. 19. Write a Shell Script which searches all files in the given directory (to be taken as command line argument) for the file having the title (to be taken as command line argument), as the first line in the file. a) Display the contents of the searched file. b) In the end, printthe the file is ###, where ### is small-sized if total no. of lines is <50 ### is medium-sized if total no. of lines between 50&100 ### is large-sized. 20. Write a shell script which reports names and sizes of all files in a directory (directory would be supplied as an argument to the shell script) whose size is exceeding 1000 bytes. The filenames should be printed in descending order of their sizes. The total number of such files should also be reported. 21. WASS for renaming each file in the directory such that it will have the current shell PID as an extension. The shell script should ensure that the directories do not get renamed. 22. WAP to calculate and print the first m Fibonacci numbers. 23. WASS that will receive any number of filenames as arguments. The shell script should check whether such files already exist. If they do, then it should be reported. The files that do not exist should be created in a subdirectory called mydir. The shell script should first check whether the sub-directory mydir exists in the current directory. If it doesnt exist, then it should be created. If mydir already exists, then it should be reported along with the number of files that are currently present in mydir.

24. A shell script receives even number of filenames. Suppose four filenames are supplied, then the first file should get copied into second file, the third file should get copied into fourth and so on. If odd number of filenames is supplied then no copying should take place and an error message should be displayed. 25. WASS to identify all zero-byte files in the current directory and delete them. Before proceeding with deletion, the shell script should get a conformation from the user. 26. WASS to compute the GCD and LCM of two numbers. 27. Two numbers are entered through the keyboard. WAP to find the value of one number raised to the power of another. 28. WASS that prompts the user for the password. The user has maximum of 3 attempts. If the user enters the correct password, the message Correct Password is displayed else the message Wrong Password. 29. WASS that repeatedly asks the user repeatedly for the Name of the Institution until the user gives the correct answer. 30. WAP to generate all combinations of 1, 2 and 3 using for loop.

Examination Scheme:
Components Weightage (%) CT1 (Lab) 5 CT2 (Lab) 5 PR 15 Attd 5 EE 70

You might also like