Question on Shell Scripts in UNIX.

Question Bank
13.1 Write a shell script which will list the files that correspond to c programs and have an extension (.c) in it.
13.2 Write a shell script that will display the setting of your path variable.
13.3 Suppose you are in your home directory which has sub-directories dir-1, dir-2, dir- 3, dir-4 and dir-5. Write a shell script which uses touch command in it to create files fil-i in dir-i for i taking values from 1 to 5.
13.4 Write a shell script that will display five most recently modified files.
13.5 Write an interactive shell script which will wait to accept a message from you and then promptly responds with “thanks for your communication”.
13.6 Write a shell script that accepts a file name from the user as a command line argument and then outputs the information when it was last modified.
13.7 Suppose in the current directory, amongst other files we have k files by name file1, file2, … filek where we do not know the value of k. Write a shell script that shall append these files to create a new file with contents of file1 followed by that of file2 …etc.
13.8 Suppose we have a phone-file with names and phone numbers. Write a shell script which gives us an option to insert, delete or update a line in the phone-file.
However, at the end of the operation it always sorts the file on first names.
13.9 Write a shell script that compares two given files and displays the number of common words.
13.10 Create a mark display system. This has two actors, administrator and a normal user.
The administrator can add the following details about the students: Roll No (unique), Name and grade. A normal user can only view the marks of a particular student by entering the roll no. The admin too can view the marks. The system should give functionalities based on the user. Proper error messages must be displayed. In case of admin, it should check if the roll no already exists in case of entry to the system. Bonus: Make the grade field not null. Modify admin so that he can view the grades of all students and the average of the class. Give admin a password.(Use of grep, decision making, writing to file, validation using shell programming)
13.11 Simple Compiler interface. The program should take the name of the C file to be compiled. It should also take the dependency files (math, pthread etc) and the name of the exe that should be created. It should then compile the program. If no exe is mentioned, then the default is a.out. If the source file does not exist, print error message (do not use cc to print the error message).Bonus: Give an option to compile all “C” programs in a directory provided there is no dependency. Maintain a log of all the commands run. (Use of decision making, looping calling cc, writing to file using shell).

Comments

Popular posts from this blog

Input Output (IO) Management:HW/SW Interface and Management of Buffers.

Introduction to Operating Systems:Early History: The 1940s and 1950s

Input Output (IO) Management:IO Organization.