On Mon, Mar 29, 2010 at 11:14:24AM -0700, Bart Smaalders wrote: > On 03/29/10 11:01, Matthew Ahrens wrote: > > >How do commands like ls and find handle printing of filenames with > >arbitrary characters (newlines and such)? > > In general, badly. > > % touch `echo '\07'` > % ls > <beep> > %
Use ls -b: -b --escape Forces printing of non-printable characters to be in the octal \ddd notation. Octal escapes for non-printable characters seems like the way to go. There's also GNU ls find's -print0 and GNU xargs' --nul (-0). (GNU ls also has the -b option). Nico --