in reply to TIMTOWTDI meets Rube Goldberg
Though I've seen a lot of horrific Perl code, I can't remember any amusingly horrific Perl code right now. However, I was tickled the other day by this piece of Unix shell:
Presumably the intent was to check if $some_number is greater than one. What it actually did was create a file called "1" in the current working directory as a side effect of the test always passing! I was wondering where on earth the file called "1" in my current working directory was coming from. When I finally found the offending snippet above, I asked the perpetrator how he tested his script and was met with an embarrassed silence. He could see the funny side of it though.#!/bin/sh # ... some_number=42 # ... if [ $some_number > 1 ] ...
|
|---|