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

FAQ
It is currently Wed May 24, 2017 1:11 pm


Tutorials applicable on more than one Unix/Linux OS and shell scripts: ssh / openssl / protocols.

Author Message
debuser
  Post  Post subject: bash: -bash: output: cannot overwrite existing file  |  Posted: Mon Oct 31, 2011 7:03 am

Joined: Thu Aug 06, 2009 2:48 am
Posts: 105

Offline
 

bash: -bash: output: cannot overwrite existing file

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 !!!





Top
Display posts from previous:  Sort by  
E-mail friendPrint view

Topics related to - "bash: -bash: output: cannot overwrite existing file"
 Topics   Author   Replies   Views   Last post 
There are no new unread posts for this topic. bash: Redirecting standard error to a shell variable and standard output to a file

debuser

0

1933

Mon Oct 31, 2011 6:54 am

debuser View the latest post

There are no new unread posts for this topic. How to change user login shell to bash in Linux

mandrei99

0

647

Thu Jan 22, 2015 11:37 am

mandrei99 View the latest post

There are no new unread posts for this topic. Daemontools /service/test/log: unable to open supervise/ok: file does not exist

debuser

0

1473

Thu Nov 26, 2009 7:11 am

debuser View the latest post

There are no new unread posts for this topic. Linux - Unable to login (and authentication succeeds) - File size limit exceeded

debuser

3

458

Tue Dec 06, 2011 8:24 am

admin View the latest post

There are no new unread posts for this topic. Normalizing terminal prompt (or putty prompt) after catting a binary file

debuser

2

542

Mon Jul 29, 2013 1:02 am

jonnblaze View the latest post

 

Who is online
Users browsing this forum: No registered users and 0 guests
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum
Jump to:  
News 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