linux and C
I have 2 Questions:
Question 1:
The program first displays a list of commands (ls, pwd, ps) and exit.
It asks the user to select a command he wants to run (exit to terminate the program).
The parent process then creates a child process that executes the selected command. During that time the parent process must wait. Once the child process is finished, the parent process displays the list of commands again and continues as described above.
Questoin 2:
The parent process creates a PIPE and a child process.
The parent process reads a text file (create a file before running the program) and passes the contents of the file (word by word) to the child process through a PIPE.
The child process reads the PIPE and prints only those words which are less than 5 characters long. It also counts such words and displays this count when there is no more data in the pipe. The child process then terminates.
The parent process closes the files and terminates too
|