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

FAQ
It is currently Mon Sep 16, 2019 10:39 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 - Linux Shell: "Cannot overwrite existing file" when the file is owned by you
Author Message
Post subject: Linux Shell: "Cannot overwrite existing file" when the file is owned by you  |  Post Posted: Mon Aug 24, 2009 10:26 am
If the shell noclobber environment variable is set, you will not be able to overwrite a file's content by redirecting some output to it.
Code:
# echo "2nd Overwritten content">tmp.file
bash: tmp.file: cannot overwrite existing file

First option would be to disable the noclobber variable:
Code:
# set +o noclobber; set -o | grep nocl
noclobber       off


The second option is to use the pipe (|)right after the redirection sign:
Code:
# echo "2nd Overwritten content" >| tmp.file
# cat tmp.file
2nd Overwritten content
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