Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!sun-barr!apple!vsi1!wyse!bob From: bob@wyse.wyse.com (Bob McGowen Wyse Technology Training) Newsgroups: comp.unix.wizards Subject: Re: Look! An xargs!! (Re: recursive grep) Message-ID: <2404@wyse.wyse.com> Date: 6 Sep 89 19:03:15 GMT References: <666@lakart.UUCP> <1641@cbnewsl.ATT.COM> <7774@cbmvax.UUCP> <16816@pasteur.Berkeley.EDU> <1126@virtech.UUCP> Sender: news@wyse.wyse.com Reply-To: bob@wyse.UUCP (Bob McGowen Wyse Technology Training) Organization: Wyse Technology Lines: 38 In article <1126@virtech.UUCP> cpcahil@virtech.UUCP (Conor P. Cahill) writes: >In article <16816@pasteur.Berkeley.EDU>, deboor@buddy.Berkeley.EDU (Adam R de Boor) writes: >> ---deleted--- >> while read arg; do >> args="$args $arg" >> done ---deleted--- > >Yet another non-solution. This one does not handle the problem where the >list of arguments exceeds the maximum length (usually 5120 bytes). true, but a test could be added to avoid this problem. As a quick and not too efficient solution: if [ `echo $args|wc -c` -gt 3000 ] then $* $args fi A final product would require better checking, I think, and testing of command line items, etc, but this would seem to be a way to start. >Also there is a dependency that the args variable in the while loop is >available outside the loop. I have found that this is not always true >due to the fact that the while loop may be implemented using a sub-shell. ONLY when the loop's input or output is redirected to/from other programs or a file. If this is not the case the loop will always execute in the current shell. Thus the form in the example is quite valid. >I guess we need a post-graduate level course, or a beginners c program class. OK, but are you willing to pay for it? Bob McGowan (standard disclaimer, these are my own ...) Customer Education, Wyse Technology, San Jose, CA ..!uunet!wyse!bob bob@wyse.com