Advanced Exercises


10.

When you use the redirect output symbol (>) with a command, the shell creates the output file immediately, before the command is executed. Demonstrate that this is true.

11.

In experimenting with shell variables, Alex accidentally deletes his PATH variable. He decides that he does not need the PATH variable. Discuss some of the problems he may soon encounter and explain the reasons for these problems. How could he easily return PATH to its original value?

12.

Assume that your permissions allow you to write to a file but not to delete it.

  1. Give a command to empty the file without invoking an editor.

  2. Explain how you might have permission to modify a file that you cannot delete.

13.

If you accidentally create a filename that contains a nonprinting character, such as a CONTROL character, how can you rename the file?

14.

Why does the noclobber variable not protect you from overwriting an existing file with cp or mv?

15.

Why do command names and filenames usually not have embedded SPACEs? How would you create a filename containing a SPACE? How would you remove it? (This is a thought exercise, not recommended practice. If you want to experiment, create and work in a directory that contains only your experimental file.)

16.

Create a file named answer and give the following command:

$ > answers.0102 < answers cat 


Explain what the command does and why. What is a more conventional way of expressing this command?




A Practical Guide to UNIX[r] for Mac OS[r] X Users
A Practical Guide to UNIX for Mac OS X Users
ISBN: 0131863339
EAN: 2147483647
Year: 2005
Pages: 234

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net