File remove command?

Brian Beattie beattie at visenix.UUCP
Mon Jun 17 00:38:12 AEST 1991


In article <3431 at crdos1.crd.ge.COM> davidsen at crdos1.crd.ge.com (bill davidsen) writes:
->Has anyone written a remove command which will unlink all links to a
->file inode when the command is issued on any one name? Yes I know it's
->dangerous, but there are times when I want certain data unconditionally
->off my system.

If the real aim is to remove the data how about:

cat /dev/null >offendingfile
rm offendingfile

This may leave the inode if links exist but the file will
have been truncated to zero length i.e. no data.

To all nitpickers yes with some shells you can replace the cat command
with:
>offendingfile
and if you do not know why that is not portable you should not
try to correct me.

The other solution is to use ncheck to find all links to said file
NOTE if a process has the file open even that will not actually get
rid of the inode.
-- 
It is easier to build a   | Brian Beattie          (703)471-7552
secure system than it is  | 11525 Hickory Cluster, Reston, VA. 22090 
to build a correct system.|
           M. Gasser      | ...uunet!visenix!beattie



More information about the Comp.unix.shell mailing list