SPUG: Multiple uses of <STDIN> in a script?

Tim Maher/CONSULTIX tim at consultix-inc.com
Fri Oct 15 16:07:12 CDT 1999


>> Message submitted at: Fri Oct 15 14:07:12 PDT 1999
X-Mailer: ELM [version 2.4 PL25]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Content-Length: 1471      

Sorry, I originally posted this to a different list!  Here it is for SPUG.

According to Tim Maher/CONSULTIX:

> Good point about buffer size. However xargs isn't a good option here,
> as xargs interferes with STDIN, often causing unexpected results in
> the target program.

xargs might indeed be a lousy option for Ryan, especially if he wants
to read all the incoming filenames with a single instance of his script.

That's why I think his pipeline input approach should be preserved,
and the Perl script changed to handle it.

What exactly do you mean by "xargs interferes with STDIN"?  The only
drawback I see is that "find . -print | xargs perl_script_taking_args"
would execute an unpredictable number of separate instances of the
perl script (each being invoked with the maximum permitted number of
arguments), which might be less desirable than a single instance reading
an "infinite" amount of pipeline input.  However, in cases like
	find . -print | xargs chmod o-r
this issue of separate instances being run is of no concern whatsoever!
 
> jim
*==================================================================*
| Tim Maher, PhD  CEO, Consultix &    (206) 781-UNIX/8649          |
|      Pacific Software Gurus, Inc.   Email: tim at consultix-inc.com |
| "The UNIX/Perl Training Experts"    http://www.consultix-inc.com |
|Classes: 11/1 Shell/Utils  11/15 Adv Shell  12/7 LINUX  12/13 Perl|
*==================================================================*

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    POST TO: spug-list at pm.org        PROBLEMS: owner-spug-list at pm.org
 Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
 SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
        Email to majordomo at pm.org: ACTION spug-list your_address





More information about the spug-list mailing list