Question: Pipes in C / Linux In this task, we want to call two bash commands from our program and print out all the messages related
Pipes in C / Linux

In this task, we want to call two bash commands from our program and print out all the messages related to the operation of the kernel that are recorded today in the kernel ring buffer. The mentioned two commands can be "dmesg" and "sed". setup a pipe fork a child For the child environment: (a) redirect STDOUT_FILENO to the second element of the pipe file descriptor array (fd) by using dup2() function. (b) close the first element of the pipe file descriptors array (fd) (c) execute dmesg command: dmesg-T by using the function excel For the parent environment: (a) redirect STDOUT_FILENO to the first element of the pipe file descriptor fd by using dup2() function. (b) close the second element of the pipe file descriptor fd (c) in a text file explain what the following line does in bash: sed -n -e '/pattern/, existp' (d) execute the above sed command with an appropriate pattern by using the function excel (e) in a text file store the output of your program and submit it
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
