– POSIX Shell
You are trying to get a job in a well-known operating system development company. During a job interview, a manager suggests you should be able to write a useless shell program. Let us call it MS-EGGSHELL. The shell should be able to create a new process, using a fork() function call. The only accepted input will be the byte position of a character in the (this) program source code. Three clones should be generated, each one of them should run a lseek(). The first clone will access and display 5 characters, starting at the byte at the position specified in the command P, the second will display the 5 characters at position +10, and the third at position +20. Your mission is to write the MS-EGGSHELL program (it should be very short, less than 50 lines for sure) that creates a new process and executes the display
You must use the CYGWIN system or any UNIX like system.
Possible output for 3 (Assume the source code file contains ABCDEFGHIJKLMNABCDEFGHIJKLMNABCDEFGHIJKLMN):
DEFGH NABCD JKLMN
Hints: notice that in order to access a file you will need to open and close it. The user never types anything wrong so you do not need to check the input for errors. It is also important to notice that you could write such a program without using fork, however you are required to do it. The difference would be that the displays would occur sequentially instead of possibly in parallel. An example of printing command for a single character x in C is printf(“text %c”,x);