![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| script to automate mksysb via nim in AIX 5.3 | barkath | Shell Programming and Scripting | 0 | 12-20-2007 06:46 PM |
| How to call a perl script from a shell script | anumkoshy | Shell Programming and Scripting | 2 | 08-30-2007 04:23 AM |
| Wget call in a Perl script | rahulrathod | UNIX for Advanced & Expert Users | 1 | 12-28-2005 06:45 AM |
| how to call a perl script from tcsh? | megastar | Shell Programming and Scripting | 1 | 10-22-2005 05:48 PM |
| how can call perl script as command? | umen | UNIX for Dummies Questions & Answers | 1 | 10-14-2005 09:43 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
here document to automate perl script that call script
I am trying to use a here document to automate testing a perl script however when the perl script hits a
Code:
system(perl subscript.pl) here is my script Code:
$ 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 while testing this i also found a odd out put from perl Code:
$ 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
$
Code:
system("perl runtest.pl");
Code:
print $buffer; print "me"; |
|
||||
|
Code:
program <<-EOF | tee -a funcscnlog.log y functional 2 $testcase reload keep EOF (b) move all the text from "y" to "EOF" to the far left, at the very least the "EOF" must be in the far left column. |
|
||||
|
the - in front of EOF tells the here doc to ignore any leading whitespace to allow it to be indented for easy looking code. There is no problem with the here document as I use this syntax on numrous other occassions successfully. The problem only occurs when the perl script "program" calls a subscript
|
|
||||
|
apparently it is due to the way perl buffer all 1024 bytes of stdin on the first call leaving it not readable for the rest subsequent calls.
I have replaced the system("perl runtest.pl"); with Code:
require "runtest.pl"; |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|