technology

A developer’s nightmare

64294079

I had a mini scare a few weeks ago when I was setting up my new Macbook. I had figured out all the weird configurations I had made on my old one to make developing more efficient for myself and was just about ready to dive back into coding.

I was porting over one final script that I kept to clean pyc files.

find ~/ -name '*.pyc' -delete

I accidentally excluded the “-” and ended up with

find ~/ name '*.pyc' -delete

And yep, you guessed it; I wiped out my home directory… Thankfully this was on my new Macbook so the damage was limited, but just thinking of what would have happened if I had done it on my other laptop terrifies me.

It also made me reevaluate using rm. I’ve heard of people aliasing rm so that it moves the file/directory to the trash can but I’ve also heard that this can cause people to become desensitizes and lead to catastrophes on a production server where your configuration may be different.

For now, I’ve installed rmtrash and added an alias to force this new habit.

alias rm='echo rm is disabled. use rmtrash! didnt remove: '

I dodged a bullet this time but I was also reminded that backing up frequently is always important too 🙂

Discussion

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s