When should you use >|
for redirecting output to a file instead of just >
?
The explanation given when I was shown this was that it guaranteed the target file was truncated first. But I thought >
already implied that.
Is >|
useful?
bashio-redirectionshell
When should you use >|
for redirecting output to a file instead of just >
?
The explanation given when I was shown this was that it guaranteed the target file was truncated first. But I thought >
already implied that.
Is >|
useful?
Best Answer
It's an explicit bypass of
noclobber
option.That way, you can overwrite the file even with
noclobber
set.See http://mywiki.wooledge.org/NoClobber
From
man bash
: