Wednesday, February 23, 2011

TOS Chapter 7 Exercises

7.2.2.
I agree that the diff command using the -u parameter is much easier to read because it provides the entire file so you can get a sense of where in the file the changes were made. The diff command without the -u parameter just prints the changes, < the original line and > the new line.

7.8
I'm not sure if I understood this exercise fully. We're supposed to create a text file called bar.txt and put some information in it. Then diff this file with /dev/null because this represents an empty file and pipe the results to the patch, foo.patch. I opened the patch and the file contained the information from the bar.txt file so I'm assuming that this was right.

 diff -u bar.txt /dev/null > foo.patch

7.9
The patch for the echo.c file seemed to be fairly straight forward. I just followed the steps to create the patch and edit the file. My patch file ended up looking like the example.
Then I wanted to check the code to make sure it would run after the changes. The example said to enter ./configure$ make. I was confused here because that was a strange command. Then I realized it was a typo and that they are two separate commands, ./configure and THEN make.
I typed in src/echo is this reversed and "reversed this is" was the output.

It was pretty cool learning about the diff command and how to create patches.

No comments:

Post a Comment