How do I override the bash "noclobber" option?

Yes. Append | to the redirection operator to form >|. This is in § 3.6.2 of the Bash Reference Manual, q.v.

If the redirection operator is ‘>’, and the noclobber option to the set builtin has been enabled, the redirection will fail if the file whose name results from the expansion of word exists and is a regular file. If the redirection operator is ‘>|’, or the redirection operator is ‘>’ and the noclobber option is not enabled, the redirection is attempted even if the file named by word exists.

Visit this tutorial about the noclobber option. It might be of help.


Use | ("pipe") in bash, instead of ! ("bang") as you would in csh. For example:

echo done >| out

Note that if you want to redirect stderr to stdout and override noclobber, neither >|& nor &>| will work; use the long form instead:

cmd-with-errors done >| out 2>&1