
January 8th, 2013, 09:07 PM
|
 |
Contributing User
|
|
Join Date: Apr 2012
Location: spaceBAR Central
|
|
If i understand what you trying to do, This is one way:
Code:
use strict;
use warnings;
my @cmd_list = ( 'echo $ORACLE_SID', 'ORACLE_SID=TEST;export ORACLE_SID', 'echo A', 'echo B', 'echo $ORACLE_SID' );
my $cmd;
my $shell_cmd;
my $child_pid;
$child_pid = open( $shell_cmd, '|-', '/usr/bin/ksh' ) or die "Error opening shell process: $!\n";
foreach $cmd ( @cmd_list ) {
print $shell_cmd "$cmd\n";
}
print $shell_cmd "exit\n";
close $shell_cmd;
waitpid( $child_pid, 0 );
print "Finished..\n";
$ test_shell.pl
QINTER
A
B
TEST
Finished..
|