Question: Write a C program that does the following: Takes an input from the command line. This input can be a sequence of characters without separators,

Write a C program that does the following: Takes an input from the command line. This input can be a sequence of characters without separators, such as date or ls, or a sequence that contains separators (e.g., space or "-"), such as ls -1. Let's refer to this input as cmd if only one word, or cmd and params if more than one word. If the input has multiple separators, cmd is the sequence of characters before the first separator, and params is the rest of the input. For example, if the input is: ls -a -1 then cmd is ls' and params is '-a -1'. Creates a new process (using fork()); Makes the new process execute cmd with params as parameters, if given. Waits for the new process to finish executing, and then prints ++++ on a new line. Write a C program that does the following: Takes an input from the command line. This input can be a sequence of characters without separators, such as date or ls, or a sequence that contains separators (e.g., space or "-"), such as ls -1. Let's refer to this input as cmd if only one word, or cmd and params if more than one word. If the input has multiple separators, cmd is the sequence of characters before the first separator, and params is the rest of the input. For example, if the input is: ls -a -1 then cmd is ls' and params is '-a -1'. Creates a new process (using fork()); Makes the new process execute cmd with params as parameters, if given. Waits for the new process to finish executing, and then prints ++++ on a new line
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
