Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please show the code and output after running the code The output should look like this: Create a program in C that takes 2 Linux
Please show the code and output after running the code
The output should look like this:
Create a program in C that takes 2 Linux commands as command line arguments to your program, e.g., ls, cal. These commands should then run in different processes. For example, ls runs in the child process and cal runs in the parent process. In order to run Linux commands from your C program, you can use execvp (char * command, char *params []) function. To read more about it, type man execvp in terminal. Make sure to keep the following in mind: - Linux commands are passed as command line arguments to your program - At least 2 Linux commands should be provided through command line arguments - Both the commands should run in separate processes, e.g., Is runs in the child process and cal runs in the parent process. - Make sure to display process ID for both parent and child process. - Finally, make sure to complete the child process before parent process completes its execution. Look into \# include for more information on this
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started