On Sep 10, 2013, at 1:25 AM, Lalit Deshmukh wrote:

> Hi,
> 
> i have implemented 50 shell program to test. now i want to run all these 
> shell program one by one(in short test automation) (once first program 
> getting executed then next will start). please let me know how to do this? in 
> UNIX any utility or to run the same. 

The are several ways to run a shell program from Perl:

1. Use the system function. This will fork a process and run (exec) the shell 
program in that process. Standard output from the program will go to your 
standard output. The system call will return the exit status from the program 
as part of its return value. See 'perldoc -f system' for details.

2. Use the qx() operator or backticks (e.g., `program`). This will also result 
in a fork and exec, but the standard output from the program will be captured 
and returned to your program. See 'perldoc perlop' and search for "Quote-like 
Operators" or "qx/STRING/".

3. Use the open() function with a MODE of "|-" or "-|". In this case, you can 
either pipe input to the program with mode "|-" or receive output from the 
program with "-|". There are more complicated ways to do both. See 'perldoc -f 
open' for details. 

See also 'perldoc perlipc' for more suggestions on inter-process communication.


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to