Linux, FreeBSD, Juniper, Cisco / Network security articles and troubleshooting guides

FAQ
It is currently Thu Jul 02, 2020 10:21 am


Username:
Subject:
Message body:
Enter your message here, it may contain no more than 60000 characters. 

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
Font size:
 
Font colour
Options:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Disable BBCode
Disable smilies
Do not automatically parse URLs
Confirmation code
Confirmation code:
In an effort to prevent automatic submissions, we require that you enter both of the words displayed into the text field underneath.
     

Topic review - bash: -bash: output: cannot overwrite existing file
Author Message
Post subject: bash: -bash: output: cannot overwrite existing file  |  Post Posted: Mon Oct 31, 2011 7:03 am
In Bash shell, redirecting output to a existing file is not possible if the "noclobber" bash option is set.

To overcome this, use the ">|" or ">>" redirect operator. The pipe will overwrite the file if you are using single angle bracket and append if you're using double angle brackets.

How to forcely overwrite a file with output from a command:
Code:
# cat output
# echo 'output' >output
-bash: output: cannot overwrite existing file
# echo 'output' >|output
# cat output
output

!!! Caution: using the ">|" operator can potentially overwrite important system/configuration files !!!
Jump to:  
cronNews News Site map Site map SitemapIndex SitemapIndex RSS Feed RSS Feed Channel list Channel list


Delete all board cookies | The team | All times are UTC - 5 hours [ DST ]



phpBB SEO