Re: system - rsh problem

2001-06-28 Thread Michael Fowler

On Thu, Jun 28, 2001 at 11:50:24AM +0200, Stefan Zwijsen wrote:
> 
> Hi,
> 
> I try to execute the following line on Solaris:
> system ("rsh","btzp17","`/usr/local/bin/perl -e "foreach $line
> (@allfiles) { print $line;}"`") ;

The intent behind the code you have here is very difficult to figure out. 
Your syntax error is a result of quoting problems.

system ("rsh","btzp17","/usr/local/bin/perl -e "foreach $line
   ^   ^
   ^   ^- and this is where it ends
   ^- this is where this string starts

(@allfiles) { print $line;}"`") ;
   ^ ^
   ^ ^- and end
   ^- string start

Are you trying to somehow print the values of @allfiles into your system
argument, or did you miss the extra quotes?


> 
> @allfiles is a list of pathnames and files
> The lines should be printed via a rsh on a station called btzp17.
> 
> If I execute
> rsh btzp17 /usr/local/bin/perl -e 'foreach $line (@allfiles) { print
> $line ;}'
> at the command line it works.

How does this even work?  Where is the remote perl program getting
@allfiles?  There is no initialization of the variable in the snippet.

 
Michael
--
Administrator  www.shoebox.net
Programmer, System Administrator   www.gallanttech.com
--



system - rsh problem

2001-06-28 Thread Stefan Zwijsen


Hi,

I try to execute the following line on Solaris:
system ("rsh","btzp17","`/usr/local/bin/perl -e "foreach $line
(@allfiles) { print $line;}"`") ;

@allfiles is a list of pathnames and files
The lines should be printed via a rsh on a station called btzp17.

If I execute
rsh btzp17 /usr/local/bin/perl -e 'foreach $line (@allfiles) { print
$line ;}'
at the command line it works.

>From within the script it doesn't work. I receive the following error:
Bareword found where operator expected at -e line 1, near "/var/adm"
(Missing operator before adm?)
syntax error at -e line 1, near "/var/adm "
Execution of -e aborted due to compilation errors.
(The /var/adm is expanded from @allfiles)

Thanks for any help,
Stefan.