LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices


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

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


I have a script with something like the following:
Code:
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?

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

Rep: Reputation: 96
Hi.

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

Dave
 
1 members found this post helpful.
Old 04-15-2010, 11:42 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
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:

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


Reply


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 11:53 AM
Output and Error redirection in Shell script (MinGW) montylee Programming 6 09-08-2006 05:06 AM
shell script output redirection goral.j Programming 3 01-27-2005 05:34 AM
I/O redirection in a shell script gladeiator Programming 1 11-27-2003 01:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:43 AM.

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