On Sat, Oct 14, 2017 at 1:08 AM, Philip Guenther <guent...@gmail.com> wrote: > You want a version of xargs that, instead of requiring special handling for > 5 characters legal in filenames (quote, double-quote, backslash, space, tab, > newline), will be completely unable to handle exactly one of those > characters (newline)? Easy: create this two line shell script under some > convenient name and use it instead:
Not completely unable, but when working with files supplied by other people, spaces in file names are common, apostrophes less so but still present. Quotes, backslashes and tabs quite rare, and I have never encountered file names containing newlines. > #!/bin/sh > sed 's!\(.\)!\\\1!g' | xargs "$@" Thanks, I'll try that - or a variation - next time. I wish it had occurred to me, but I'm kind of slow sometimes. > My personal preference is to pick either of the following options: > a) don't use any of those characters in filenames and just use xargs bare > b) go directly into perl or C once I reach the limit of -0 option handling > > IMO, (a) makes sense for stuff you control the name of, (b) for stuff where > you don't. The set of people I trust to create filenames containing space, > tabs, or quotes, but not newlines is *empty*. I guess I deal with a different kind of person than you. Thanks again, -- Raul