shell script redirection -- a question
I have a script with something like the following:
Code:
echo "blah blah ... blah" >| /my/file I've looked all over and do not find this syntax explained. I feel silly that (1) I can't find an explanation, and (2) I don't already know this. Would someone kindly explain "echo stuff >| /myFile" redirection? Cheers, ~~~ 0;-Dan |
Hi.
The '>|' form of redirection ignores the 'noclobber' setting, so the redirection won't fail even if the target file exists. Dave |
The GNU bash reference explains it (and the man page is similar): "The general format for redirecting output is:
[n]>[|]word 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". |
All times are GMT -5. The time now is 01:27 PM. |