Skip to main content
10 events
when toggle format what by license comment
Jul 24, 2014 at 7:11 comment added user16402 @ardnew yes there is. the first two lines (v=2 and v+=2): to someone unfamiliar with Bash variable handling, that would be equivalent to 2+2, but it is in fact "2"+"2", i.e. "22". the other comments in the code are only wrong because of this. I know, not everyone finds this funny
Jul 24, 2014 at 4:07 comment added ardnew i don't understand how this meets the requirements. there isn't a single addition expression of the form "2+2" anywhere in the code. the only underhanded aspect of this code is the misleading comments. you could have read the value "A=2.5" from a file, added a false comment that says it has the value "A=2", and then printed the result of "A+A"
Jul 3, 2014 at 19:54 comment added user16402 @nyuszika7h It's probably easy to spot if you're very familiar with Bash. But users of other languages will expect Bash to handle 2 as an integer.
Jul 2, 2014 at 8:41 comment added user344 Nice one, but I spotted the += thing immediately.
Jun 9, 2014 at 21:29 comment added Dennis Williamson See if you like the look of this style which is also valid Bash (eliminates the dollar signs, allows spaces around the equal sign and allows combined assignment operators): ((v = v * 5)) or ((v *= 5))
Jun 3, 2014 at 10:00 comment added Joe Harper Oh this is just fabulous. lmao
Jun 1, 2014 at 16:28 comment added user16402 @tomsmeding It was quite fun, although about halfway through I realised that I had put 15 instead of 16 in line 4. Luckily, it still worked because of bc's rounding
May 31, 2014 at 19:07 comment added tomsmeding Nice maths trick going on there!
May 31, 2014 at 11:09 history edited user16402 CC BY-SA 3.0
added 210 characters in body; added 3 characters in body
May 31, 2014 at 10:11 history answered user16402 CC BY-SA 3.0