1

What does the >|-redirection in bash do?

I just found out, that echo text >| somefile creates the file somefile (if not existing yet), and fills it with text. Similar as echo text > somefile would do.

Further experiments suggest that the >|-redirection behaves as the >-redirection does.

So, what is the >|-redirection exactly?

Since it's hard to google for the string ">|", I could not really search the web (so I have added "greater-pipe" in the title of this question since that is google-able).

1 Answers1

1

It is in the bash manual (3.6.2 Redirecting Output):

If the redirection operator is >|, or the redirection operator is > and
the noclobber option to the set builtin command is not enabled, the redirection is attempted even if the file named by word exists.

Thomas Dickey
  • 76,765