W
whcchoi
Hi,
I have a perl script which executes a command which will in term
requires input, I have the following program:
my $cmd = "ipa add";
print "Executing -> $cmd\n\n";
my $pid = open(H, "$cmd |") or die("\n$cmd failed\n");
my($stat, $data);
my $str;
while (sysread(H, $data, 1)) {
if (defined ($data)) {
$str .= $data;
if ($str =~ /Please enter View name\(use \'quit\' to
exit\): /) {
===> NEED HELP HERE
}
}
}
I need help with "NEED HELP HERE", if my cmd "ipa add" requires input
of "abc", how can I provide that and interact with "ipa add"??
I tried:
print H "abc\n";
syswrite() --> don't know what argument to use
None worked. However, It can accept input from STDIN (i.e. I can
interact with my script in the screen where I run my script)..
Please help.
Thanks,
Claudia
I have a perl script which executes a command which will in term
requires input, I have the following program:
my $cmd = "ipa add";
print "Executing -> $cmd\n\n";
my $pid = open(H, "$cmd |") or die("\n$cmd failed\n");
my($stat, $data);
my $str;
while (sysread(H, $data, 1)) {
if (defined ($data)) {
$str .= $data;
if ($str =~ /Please enter View name\(use \'quit\' to
exit\): /) {
===> NEED HELP HERE
}
}
}
I need help with "NEED HELP HERE", if my cmd "ipa add" requires input
of "abc", how can I provide that and interact with "ipa add"??
I tried:
print H "abc\n";
syswrite() --> don't know what argument to use
None worked. However, It can accept input from STDIN (i.e. I can
interact with my script in the screen where I run my script)..
Please help.
Thanks,
Claudia