I am trying to use a here document to automate testing a perl script however when the perl script hits a
system(perl subscript.pl)
call, input is no longer entered into this subscript.
here is my script
$ cat test.sh
#ksh
for testcase
do
program <<-EOF | tee -a funcscnlog.log
y
functional
2
$testcase
reload
keep
EOF
cd log
cp x.log x.$testcase.log
cd ..
done
$ sh test.sh TC01 TC02 TC03
I don't really want to use expect as I don't want to install anything else on the test system.
while testing this i also found a odd out put from perl
$ cat test.pl
print "infirst ";
my $buffer = <STDIN>;
chomp($buffer);
print $buffer;
print "me";
system("perl runtest.pl");
print "\naftercall ";
my $buffer = <STDIN>;
print $buffer;
print "\n";
$ cat runtest.pl
print "\ninsubtest ";
my $buffer = <STDIN>;
chomp($buffer);
print $buffer;
$ perl test.pl
infirst a
insubtest b
bame
aftercall c
c
$
if you look closly you will see
system("perl runtest.pl");
is run before
print $buffer;
print "me";