zsh: Disable "file exists:" warning with redirection

You can force the ZSH to clobber on redirect with:

>!

Same as >, except that the file is truncated to zero length if it exists, even if CLOBBER is unset.

or

>>!

Same as >>, except that the file is created if it does not exist, even if CLOBBER is unset.


Does your setopt output mention noclobber? If so, that's it, just setopt clobber

The documentation for the option is at http://zsh.sourceforge.net/Doc/Release/Options.html#index-file-clobbering_002c-allowing


Others have recommended using >! or >>! but these are not POSIX standard. The POSIx compliant way to overwrite files without prompting is to use >| or >>| and this will work in any shell.

For information see here: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_07_02