Weird Files...
jc at trillian.mit.edu
jc at trillian.mit.edu
Fri Oct 27 17:17:13 EDT 2000
--------
Patrick McManus writes:
| [jc at trillian.mit.edu: Fri, Oct 27, 2000 at 11:54:12AM -0400]
| > I wonder what the most abstruse way to remove a file might be?
|
| I make no claims as to robustness, and sure it speaks of permission
| and resource abuse, but here's a waster that gets the job done:
|
| #!/bin/bash
| d=`pwd`
| cd /
| tar cvf /tmp/blah.tar $d
| rm -rf $d
| tar xv -f /tmp/blah.tar --exclude $1
That's wonderful! I bet that if you recode it in Visual Basic, you
can sell it to Microsoft and collect some royalties.
But I do note one potential problem: It doesn't work too well if
you're inside the /tmp directory. There just might be a fix for this
bug. Let's see ...
#!/bin/bash
d=`pwd`
cd /
tar cvf /tmp/blah.tar $d
cat /tmp/blah.tar | (rm -rf $d; tar xvf - --exclude $1) &
wait
Yeah; that's the ticket. The cat process holds the tar file open in
case rm unlinks it. Then the tar starts reading from the pipe,
getting the file that no longer has a name. We just hope there isn't
a power failure while tar is running.
Truly demented ...
-
Subcription/unsubscription/info requests: send e-mail with
"subscribe", "unsubscribe", or "info" on the first line of the
message body to discuss-request at blu.org (Subject line is ignored).
More information about the Discuss
mailing list