sml@wdl1.UUCP (07/20/84)
#N:wdl1:17100004:000:521 wdl1!sml Jul 20 09:29:00 1984 Here's an entertaining exercise. (I suggest you do it in a scratch directory that you can delete by a "rm -rf" if all else fails.) Create a file "-f" by doing an "echo > -f". Adding a few more files to this directory will make life a bit more fun. Now try to do anything useful with the "-f" file (ls, rm, cat, ...). I won't spoil the fun by revealing what's going on here. Steve Lazarus Ford Aerospace MS X-20 3939 Fabian Way Palo Alto, CA 94303 (415) 852-4203 sml@ford-wdl1 (ARPA) ...fortune!wdl1!sml (Usenet)
charles@utastro.UUCP (Charles Sandel) (07/24/84)
<Groan> "mv" has a "-" option which will get you out of silly exercises like this. -- *>> Charles Sandel <<* uucp: {ut-sally, ut-ngp, noao, charm}!utastro!charles arpa: chaz@ut-ngp or charles@ut-sally at&t: (512) 471-4461 x439
achut@callan.UUCP (Achut Reddy) (07/26/84)
. echo > -f rm ./-f cat ./-f ls ./-f echo bfd
dan@haddock.UUCP (07/27/84)
#R:wdl1:17100004:haddock:16800022:000:171 haddock!dan Jul 25 21:12:00 1984 It's easy to work with files like these by preceding the name with "./", as in ls -l ./-f I suggest info-unix rather than unix-wizards for this... Dan Franklin
acheng@uiucdcs.UUCP (08/03/84)
#R:wdl1:17100004:uiucdcs:13700056:000:1448 uiucdcs!acheng Aug 3 04:54:00 1984 >... Another *really* >fun experience that I had with file names came as a result of some >(heretofore forgotten) program barfing and creating a file with >*control* characters as part of the file name -- it wouldn't have been >*too* bad if I could have used rm -i and matched a printable >character, but *none* were printable and I was running on a system >without -i.... Any guesses as to how I rm'ed it? No, I didn't rm *. One may cp all the good files away, "rm -r troubledir" and then reconstruct the directory. But if there are sub-dirs, it takes more effort. I once was in a system that could not "mv dir newdir" and i solved that by: 1) cd troubledir 2) tar cf /tmp/TMP.tar . 3) cd ..;rm -r troubledir;mkdir troubledir;cd troubledir [strange result may happen if one tries "rm -r ." ] 4) tar tf /tmp/TMP.tar > /tmp/list 5) "edit /tmp/list" to delete those bad names; [if there is sub-dir in troubledir, retain only sub-dir names] 6) tar xfp /tmp/TMP.tar `cat /tmp/list` [the "p" option restores ownership, modes,... I forgot if i had it then.] Also, one may write a program (isn't that what we are born for?) to read the directory. Then you may choose to unlink the file or change the name ln(old, new); unlink(old); I met a terminal case--somehow the directory got trashed and the content was changed from "foobar" to "foo\0ar". rm -r couldnot delete it. I resorted to "clri" and "icheck -s" (no fsck in that system.)