General Question

robmandu's avatar

What's the worst single line of code/script/command you have ever written/seen?

Asked by robmandu (21331points) January 21st, 2008

Mine was just before homework was due for a C++ programming course, and in unix, I tried to rename all of ”.cc” file suffixes to ”.C” using the following shell command:

mv *.cc *.C

(Can you tell I was self-taught on DOS 1.0?)

Anyway, that was five minutes before class… needless to say I got zero credit for that one. Six hours of my life gone.

Observing members: 0 Composing members: 0

8 Answers

bob's avatar

You might enjoy this story.

robmandu's avatar

@bob… nice!

Another personal fave is the -r switch used with the crontab command. In typical UNIX fashion, there’s no “Are you sure?” prompt… it just removes all of your crontab entries forthwith. Here’s the rub though… the letter “r” is right next to the letter “e”.

You might not plan to remove your crontab entries with ”-r”... but if you’re scheduling jobs, you are for doggone sure using the ”-e” switch to edit the crontab. Just one fat finger away from losing a lot of what could be mission critical scheduled jobs.

Hence, my own convention when using crontab is to ALWAYS perform a “crontab -l” (outputs a read-only listing) before even attempting to edit the crontab.

And yah, I keep a duplicate copy of my various crontabs elsewhere, too…

deathfrombelow's avatar

cd /; sudo rm -r * that or sudo chmod 777 /*
The first one is by far the worst which deletes all of you files from your HDD. The second one is even worse, because then it gives everyone on that system full read-write-execute abilities on everything which means that you could do rm -r /* without sudo or being root

robmandu's avatar

@death… thanks!

Kinda looking more for anecdotal stuff you’ve seen or done yourself in the wild… with all the best intentions, y’know?

andrew's avatar

I had one friend in college who did a yes | rm -r on his home directory, but even worse was a friend who did a rm -r one directory higher than he meant to, but was so lulled by typing y y y y y y y that he systematically deleted his entire project.

Zaku's avatar

I’ve been reflecting about this. I think probably this is the worst single line of code I’ve written and run. It’s in BASIC, for an 8-bit computer with 32K or more of RAM.

10 POKE RND()*30000, RND()*256

Can you guess the next line? Actually, I tended to put it in a FOR / NEXT loop to subject computers to limited amounts of simulated irradiation. Got some pretty interesting results. With a different random seed, often different crashes and chaos.

Remembering this is making me think of more modern equivalents involving the Windows Registry and a swap function.

Breefield's avatar

I’m not into the command line stuff like you guys, but I do write a lot of php queries. It’ll happen to me on occasion, but having an elaborate WHERE and AND call on the wrong table usually makes most of your data irreperable….sucks hard.

soundedfury's avatar

alert(You must have Javascript enabled to continue.)

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther