Boston Linux & Unix (BLU) Home | Calendar | Mail Lists | List Archives | Desktop SIG | Hardware Hacking SIG
Wiki | Flickr | PicasaWeb | Video | Maps & Directions | Installfests | Keysignings
Linux Cafe | Meeting Notes | Blog | Linux Links | Bling | About BLU

BLU Discuss list archive


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weird Files...



--------

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).




BLU is a member of BostonUserGroups
BLU is a member of BostonUserGroups
We also thank MIT for the use of their facilities.

Valid HTML 4.01! Valid CSS!



Boston Linux & Unix / webmaster@blu.org