SPUG: redirecting STDIN

Tim Maher/CONSULTIX tim at consultix-inc.com
Fri Nov 5 22:53:32 CST 1999


>> Message submitted at: Fri Nov  5 20:53:32 PST 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: 1423      

According to Peter Dueber:
> 
> I have some code like this:
> 
> $x="some-string";
> system("TheirProg arg1 arg2..... <in_file>");
> 
> TheirProg expects input from either the file "in_file", or from STDIN if in_file 
> is equal to "-".  
> 
> I don't have the source for TheirProg and I would like STDIN to instead be the 
> contents of string $x.
> 
> Can this be done?
> 

Yep!

	$x="some-string";
	system(" echo '$x' | TheirProg arg1 arg2..... - ");

> 
> 
> Peter Dueber, Esq.
> HIVNET Statistical Center
> Fred Hutchinson Cancer Research Center
> Phone: 206.667.6568
> Fax  : 206.667.4812
> Email: peter at hivnet.fhcrc.org
> 
> 
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
>     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
> 
> 
> 

*==================================================================*
| 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: 12/7-10 UNIX/LINUX Fundamentals;  12/13-16 Perl + Modules|
*==================================================================*

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    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