The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
Removing the entire file contents using unix shell script.
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
Removing the entire file contents using unix shell script.
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
4
(
permalink
)
02-10-2009
pludi
Moderator
Join Date: Dec 2008
Location: .at
Posts: 1,972
Either
Code:
$ :>file
or, a bit more brutal,
Code:
$ rm -f file && touch file
The second one, though, will cause quite some havoc if a process still has a filehandle open on it.
pludi
View Public Profile
Find all posts by pludi
Find pludi's past nominations received
Find pludi's present nominations given