UNIX not having a 'trashcan' and actually expunging files permanently when you
type 'rm' came up in conversation recently. And I was, of course, firmly in the
UNIX-philosophy side of the argument, having enjoyed the simple and direct
nature of 'rm' for like... going on 20 years now, i guess.
And then, in my haste just now, while trying to upgrade to a newer emacs,
and organize/update/backup the HUGE ("megabytes of text") set of config
files (LISP programs, really) that I've accumulated over the years...
...well... I went and tried to be a bit too clever chaining commands, it seems.
Backspacing over one pipe (|) too many really messed up things. I had intended
to run this command:
find ~/.emacs.d/ | grep \\.elc | xargs rm
I had already run everything up to the "xargs" as a test. Find listed all files,
and grep filtered down to just the ".elc" files, which are the compiled (the "c")
versions of all the emacs-LISP ".el" files. The were all out of date and incompatible
with the new emacs, so i needed to erase them and rebuild them from the ".el" source.
Unfortunately, through a mishap with my command-line shortcut keys, typing too fast,
and not respecting the 'rm', when i edited a previous command to add the "| xargs rm"
and actually delete things, what I ended up with was this:
find ~/.emacs.d/ | xargs rm
Note the lack of a filter-to-elc-only step.
This blew away, in about 1.5 seconds, *EVERY* *FILE* in ~/.emacs.d/
That is, I just erased the last 20 years of settings, helpers, research, tools,
in one quick command.
Why was this not in GIT? Good question. It was *OLDER* than GIT to start with,
and, I have been slowly making a git archive for all those old, legacy things
over the past ~8 months, as i update things. Emacs was one of the last, and I
was going to make the git archive *right* *after* I updated to the new version...
So for the first time in 20 years, I'm back to a stock, clean-out-of-the-box
programming environment. I suspect I won't be able to get things back to my
proper setup for... years.
So let this be a lesson. It's *ALWAYS* a good idea to sit on your hands
for a while when using 'rm'. It's positively *INSANE* to rush through it
when you're tying 'rm' to complex programs like 'find'. Test it with 'echo'
first or something.
Better yet, don't forget that GIT is easy, and you should always
mount a
scratch monkey before big, sweeping changes...
*sigh*
I wonder if I still have a glass of that St. George absinthe left over.
This calls for liquor...