OS-(I) Assignment 2: Simulation of Operating System Shell and Its Working

Set A.

Write a C program that behaves like a shell which displays the command prompt ‘myshell$’. It accepts the command, tokenize the command line and execute it by creating the child process.Also implement the additional command ‘count’ as 
myshell$ count c filename: It will display the number of characters in given file 
myshell$ count w filename: It will display the number of words in given file 
myshell$ count l filename: It will display the number of lines in given file .


Set B.

Write a C program that behaves like a shell which displays the command prompt ‘myshell$’. It accepts the command, tokenize the command line and execute it by creating the child process. Also implement the additional command ‘list’ as
myshell$ list f dirname: It will display filenames in a given directory.
myshell$ list n dirname: It will count the number of entries in a given directory.
myshell$ list i dirname: It will display filenames and their inode number for the files in a given directory.


Set C.

1) Write a C program that behaves like a shell which displays the command prompt ‘myshell$’. It accepts the command, tokenize the command line and execute it by creating the child process. Also implement the additional command ‘typeline’ as
myshell$ typeline n filename: It will display first n lines of the file.
myshell$ typeline -n filename: It will display last n lines of the file.
myshell$ typeline a filename: It will display all the lines of the file.

2)Write a C program that behaves like a shell which displays the command prompt ‘myshell$’. It accepts the command, tokenize the command line and execute it by creating the child process.Also implement the additional command ‘search’ as
myshell$ search f filename pattern: It will search first occurrence of the pattern in the given file.
myshell$ search a filename pattern: It will search all occurrence of the pattern in the given file.
myshell$ search c filename pattern: It will count the number of occurrences of the pattern in the given file.

0 Comments:

Post a Comment