So today I was harshly reminded that in UNIX (and by extension, in Mac OS X Terminal), the "*" and "$" symbols do not mean "asterisk" and "dollars", they mean "HAHAHA FUCK YOU, ASSWIPE".
I wanted to get rid of some files named "CollatzSieveUnthreaded$1.class", "FermatChecker$1.class", "FermatChecker$2.class", etc; these are backup class files created by the Java compiler. I figured doing rm *$* would do the trick, because Java uses the "
Of course, all you holier-than-me UNIX geeks already see the problem with that command. The asterisk wildcard character in regular expressions means "the preceding element zero or more times", and the dollar symbol stands for "the ending position of the string or the position just before a string-ending newline" (thanks, Wikipedia). So "*$*" basically means "any string at all". Awesome.
Thankfully, Time Machine had come to the rescue 18 minutes prior, and my data was safe and sound on Themistocles, my external drive. So I didn't actually lose anything. But it's the principle of the thing!
0 comments:
Post a Comment