News for hackers. Stuff that matters.
Re:Why "ls *.c" is at least dumb, and possibly dangerous by __david__ on Thursday October 08, 2009 @10:28PM (#870477)
Yep. Though I don't think I've ever seen an actual legitimate use of this capability. I mean really, what's the point of an embedded newline...

Actually the Mac uses (or at least "used") a hidden files named "Icon\r" (yes, an embedded carriage return) for its custom folder icons. I'm still not sure that counts as "legitimate".

Re:Why "ls *.c" is at least dumb, and possibly dangerous by blasdel on Friday October 09, 2009 @12:49AM (#870660)
I had to write a one-liner to deal with that on Mac OS 10.4 -- had to detect if a user had placed anything on their Desktop, which had a custom folder icon because it was actually a cross-filesystem symlink:

  desktop=$(test -z $(ls -A1 /Volumes/Documents/Desktop | \ 
            sed -e '/^.DS_Store$/d' -e '/^Icon^M$/d'))
  
The ^M was a literal CR, which would get munged by all my usual editors except vim. I'm sure there's some sturdier way to escape it...

I remember choosing to use ls intentionally, but not what sucked about the alternatives.