Question: 2 . Short answer ( 3 sentences maximum ) : Explain why the following code fragment will not work as expected: pipe ( fd )
Short answer sentences maximum:
Explain why the following code fragment will not work as expected:
pipefd;
switchcpid fork
case : perrorfork failed"; break;
case :
whilereadfd buffer, sizeofbuffer
printfrecv msg: s
buffer;
break;
default:
fori ; i nummsgs; i
writefd msg sizeofmsg;
waitpidcpid NULL, ;
break;
Bash
Write a bash function that will accept a two integer arguments, x and y returning
if x is a factor of y or if it is not. Invoke the function and print is a factor or
not a factor according to the result.
Sed
Write a sed script that will:
a Remove the first number from a line, if it begins with a number
i For these lines, surround the entire line in tags
b Trim any repeat sequences of tabs andor spaces down to a single space
c Replace all sequences of digits that reside immediately prior to a
hyphen with a single x
Example input:
xr output freq
vfr outbound N cs
ifr inbound N heavy
end of data
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
