< Back
Page 11 of 11
This chapter is from the book
Advanced Exercises
- When you use the redirect output symbol (>) on a command line, the shell creates the output file immediately, before the command is executed. Demonstrate that this is true.
- In experimenting with variables, Max accidentally deletes his PATH variable. He decides he does not need the PATH variable. Discuss some of the problems he could soon encounter and explain the reasons for these problems. How could he easily return PATH to its original value?
Assume permissions on a file allow you to write to the file but not to delete it.
- Give a command to empty the file without invoking an editor.
- Explain how you might have permission to modify a file that you cannot delete.
- If you accidentally create a filename that contains a nonprinting character, such as a CONTROL character, how can you remove the file?
- Why does the noclobber variable not protect you from overwriting an existing file with cp or mv?
- 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 a file and work in a directory that contains only your experimental file.)
Create a file named answer and give the following command:
$
> answers.0102 < answer cat
Explain what the command does and why. What is a more conventional way of expressing this command?
< Back
Page 11 of 11