Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-15-2010, 12:19 PM   #1
Senior Member
Registered: Jan 2009
Location: Austin, TX
Distribution: Mint-17.3 with Cinnamon & KDE
Posts: 1,598
Blog Entries: 3

Rep: Reputation: 105Reputation: 105
shell script redirection -- a question

I have a script with something like the following:
echo "blah blah ... blah" >|  /my/file
NOTE -- the redirection is angle+pipe.

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?

~~~ 0;-Dan
Old 04-15-2010, 12:37 PM   #2
Senior Member
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 96

The '>|' form of redirection ignores the 'noclobber' setting, so the redirection won't fail even if the target file exists.

1 members found this post helpful.
Old 04-15-2010, 12:42 PM   #3
LQ 5k Club
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,577
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
The GNU bash reference explains it (and the man page is similar): "The general format for redirecting output is:


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
1 members found this post helpful.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
FTP in a Bash Shell Script redirection sleepyhomme Programming 2 05-02-2007 12:53 PM
Output and Error redirection in Shell script (MinGW) montylee Programming 6 09-08-2006 06:06 AM
shell script output redirection goral.j Programming 3 01-27-2005 06:34 AM
I/O redirection in a shell script gladeiator Programming 1 11-27-2003 02:35 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 12:54 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration