Creative Commons

2008-04-18 12:09:55

Boo you BlueFish!

I don't know either Ruby or Java at the moment, but I need to learn both. I'll be having to design a web application in jRuby on Rails so that I can utilize some open source Java code in the app. I decided I was going to start with Ruby, since I need that to get the basis of the site designed. I spent all morning researching the MVC framework, how to make things happen (controllers, partials, etc.), and started coding. Around lunchtime I had the generic site template up and working along with some AJAX to dynamically change sections of the page.
I switched from BlueFish (the GUI editor I sometimes use because it can open files in tabs) to my terminal and saw that BlueFish created automatic backups of the files I had edited. It does this by appending a ~ to the filename. I hate when it does that, it just clogs up my directory. So, I wanted to delete them. I wasn't exactly sure if I had to escape the ~, so I was going to anyway. It couldn't hurt. I wanted to run:
# rm *\~
But as I went to hit the \ key, my pinky missed and hit ENTER, thus executing:
# rm *
This whole morning's work, gone. Luckily, the only reason it took me all morning was because I was learning as I went. I was able to recreate everything in about 10 minutes now that I know what I'm doing. Still, that could have sucked really bad.



2008-05-29 08:12:43

Matt says...
Not really Bluefish's fault ;-)

Also, what if you want to delete all the hidden files and directories in a directory? Bonus points if you can tell me why this is a bad idea:

rm -rf .*

2008-05-29 08:53:12

slonkak says...
A root cause analysis would show that if Bluefish wouldn't create silly backups, I would have never attempted to enter that command. ;) But you're right, ultimately I did break it myself. As for your command, I've never executed it. But as long as `rm` does regex matching, it's not a good idea to delete a higher level directory.

2008-05-29 08:56:09

Matt says...
Yes. about 10 seconds into that command I remembered that .* also matched ..

oops :-)

2008-05-29 11:45:23

slonkak says...
Yikes. Please tell me you were in a directory where that wasn't a big deal... I hope it wasn't your home directory or anything.

Post a comment!