Do recent versions of xargs cope with exit status?
Arthur David Olson
ado at elsie.UUCP
Mon Jul 11 07:10:13 AEST 1988
Familiar scene: you want to grep for something in a large number of files.
You generate the list of file names, then
grep whatever `cat listofnames`
only to get an
arg list too long
message. "Sure wish I could tell grep to read the names of the files to handle
from a file" you think at first. Then you recall a couple of recent postings
about how such options aren't needed, since you can use xargs to get the job
done, a la
cat listofnames | xargs grep whatever /dev/null
(This does the wrong thing if there's only one filename; since we're assuming
a large number of files. . .) Sure enough, everything works fine.
Now suppose, though, that the command is
grep -s whatever `cat listofnames`
If so, doing a
cat listofnames | xargs grep -s whatever /dev/null
doesn't get the job done right. . .at least not with the System V Release 2
version on xargs that lurks on the systems around here.
And so the question: do more recent versions of xargs allow better control
of the exit status returned by xargs?
--
ado at ncifcrf.gov ADO is a trademark of Ampex.
More information about the Comp.unix.questions
mailing list