December 2002
Intermediate to advanced
1616 pages
39h 57m
English
Setting the noclobber variable
prevents you from accidentally overwriting a file when you redirect output to the file. To override noclobber, put a pipe symbol
after the symbol you use for redirecting or appending output (for example >| and >>|).
In the following example the user creates or overwrites a file named a by redirecting the output of date to the file. Next, the user sets the noclobber variable and tries redirecting output to a again. The shell returns an error message. Then the user tries the same thing ...
Read now
Unlock full access