[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: builtin read stops at '\0'

From: Greg Wooledge
Subject: Re: builtin read stops at '\0'
Date: Thu, 19 May 2011 10:39:07 -0400
User-agent: Mutt/

On Thu, May 19, 2011 at 04:30:40PM +0200, Rafaël Fourquet wrote:
> Do you mean, in your example, that e.g.
> ... do mapfile -t files <<< "$group" ; ls -1 "address@hidden"; done ...
> is better than:
> ... do  xargs -d '\n' ls -1  <<<"$group"; done ...

imadev:~$ group=$'foo\nbar\n"hi mom"\n'
imadev:~$ xargs -d '\n' printf '<%s> ' <<< "$group"
xargs: unknown option: -d

Must be some GNUism you're attempting to use (granted, the -0 was also
a GNUism, but it's at least one I've heard of -- and is also present
on most BSD boxes).

If my guess is correct, your -d option is supposed to turn off the
blatant historical stupidity and uselessness that characterize xargs:

imadev:~$ xargs printf '<%s> ' <<< "$group"
<foo> <bar> <hi mom> imadev:~$ 

Where'd the quotes go??  Oh, right, xargs eats them!

imadev:~$ group=$'foo\nbar\n"hi mom"three quotes"\n'
imadev:~$ xargs printf '<%s> ' <<< "$group"
xargs: missing quote?: quotes

So, apart from "xargs doesn't have a -d option" and "xargs without a -d
option can't handle filenames", sure, xargs is awesome!  </sarcasm>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]