This tip is for people who have ever hosed important files by using > when they meant to use >>. Add the following line to .bashrc:
set -o noclobber
The noclobber option prevents you from overwriting existing files with the > operator.
In some cases you may really want to overwrite the file. In this case, instead of turning noclobber off, you can use >! to force the file to be written.
% program >! file
hosed: 失败,(口语一点的用法)