What does >| do in bash?

bash

Solution

By executing the command

set -o noclobber

or the equivalent

set -C

you can cause bash to refuse to write to existing files when redirecting output.

Using `>|` rather than `>` overrides that setting.

References:

- The `set` builtin

- Redirecting Output

Or run `info bash` (assuming it's installed on your system) and search for `>|`:

s>\|

(If you're familiar with csh and/or tcsh, bash's `>|` (greater-than vertical-bar) is similar to csh's `>!` (greater-than exclamation-mark).

Problem

In this article, How To Create a Patch File for a RPM, there is this command: ``` diff -ru base-1.4.4-orig base-1.4.4 >| $HOME/rpmbuild/SOURCES/base-1.4.4-f12.patch ``` Since the output is written to a file, the simple redirection operator `>` works fine for me. Does this operator mean redirect to a pipe? If so, how is a redirect to a pipe different from just a redirect to a file or just a pipe to a process?

Original source