« first day (1 day earlier)    last day (1353 days later) » 

6:36 AM
hmm I think I asked my bad script question at the wrong time of the day/week. Or maybe it's just not that interesting
 
 
12 hours later…
6:29 PM
@Zanna If someone (you?) (I?) posts another answer showing other approaches than the ones taken so far, or providing other analysis of the broken code, then perhaps attention will be drawn to it.
 
yes indeed. I was hoping others might want to answer it
now I am sleepy though
I can think of a few people who I'd expect to write something good
 
I wonder if maybe it is practical to fix the original script--by which I really mean rewrite it so it's correct, but preserve the general method of passing all the filenames to file in a single command (or, better, of passing all of them that can be passed at once, as with find ... -exec ... {}{ +). For many files, this would be faster than executing file once for each file.
file (in Ubuntu anyway) supports the -r and -0 options which I think could be used to safely extract filenames from its output. So the filenames could be passed into file, the file types checked, and the filenames that appear to be JPEGs could be taken from that same output, safely because they are null-character-terminated with all original weird characters intact before the terminator, and operated on.
I don't know if I'll get around to exploring that further, and you--or anyone at all--should definitely feel free to take the initiative to write an answer about it.
 
hmm I should definitely try to use it as a learning opportunity... if I get this work done maybe I will feel less lazy with regard to the script question. Or maybe I could be lazy and throw a bounty at it
I didn't realise file had so many options... hmmm :)
 
6:48 PM
Neither did the author of the script that appeared in the magazine. :(
Also, neither did I, until today.
 
haha I don't think the author was named in that article
anonymous bash abuse
 
Maybe they were named but numerous $'\b' characters were accidentally printed after their name.
 

« first day (1 day earlier)    last day (1353 days later) »