Advanced Exercises

 < Day Day Up > 

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?

     < Day Day Up > 


    A Practical Guide to LinuxR Commands, Editors, and Shell Programming
    A Practical Guide to LinuxR Commands, Editors, and Shell Programming
    ISBN: 131478230
    EAN: N/A
    Year: 2005
    Pages: 213

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