Pipe in DOS rsh producing error 
Author Message
 Pipe in DOS rsh producing error

The part of my script:

$log= `rsh 10.1.1.1 -l dmadmin ls -t /opt/RightSite/product/log/dwlog*
| head -1`;

produces (in $log) the output "The name specified is not recognized as
an internal or external command, operable program or batch file.".
This obviously means that DOS is having trouble interpreting it. When
typing the exact command in at the commmand line it works perfectly.
It is '|' causing the error, as without it works fine as well.

Why is this?

Thanks.



Mon, 17 May 2004 13:06:49 GMT  
 Pipe in DOS rsh producing error
[Posted and mailed]



Quote:
> The part of my script:

> $log= `rsh 10.1.1.1 -l dmadmin ls -t /opt/RightSite/product/log/dwlog*
>| head -1`;

> produces (in $log) the output "The name specified is not recognized as
> an internal or external command, operable program or batch file.".
> This obviously means that DOS is having trouble interpreting it. When
> typing the exact command in at the commmand line it works perfectly.
> It is '|' causing the error, as without it works fine as well.

> Why is this?

Because DOS isn't built for the kinds of multi-tasking that you're asking
of it.  I've had various luck with pipes and redirects with DOS, depends
on what I'm trying to do, varies widely, and defies explanation when it
works (or doesn't).

Why not just:

        ($log)=`rsh`;           # Grab the first line of output

        $log=(`rsh ...`)[-1];   # Grab the last line of output only

Or some variant on this?        

--
    Clinton A. Pierce            Teach Yourself Perl in 24 Hours  *and*

"If you rush a Miracle Man,     for details, see http://geeksalad.org    
        you get rotten Miracles." --Miracle Max, The Princess Bride



Mon, 17 May 2004 14:02:23 GMT  
 Pipe in DOS rsh producing error


Quote:
> The part of my script:

> $log= `rsh 10.1.1.1 -l dmadmin ls -t /opt/RightSite/product/log/dwlog*
> | head -1`;

> produces (in $log) the output "The name specified is not recognized as
> an internal or external command, operable program or batch file.".
> This obviously means that DOS is having trouble interpreting it. When
> typing the exact command in at the commmand line it works perfectly.
> It is '|' causing the error, as without it works fine as well.

> Why is this?

I suspect you need to be explicit as to where head is ( /bin/head maybe) ??


Mon, 17 May 2004 14:25:03 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Question: rsh and pipe

2. Producing a MS DOS compiled version of a script

3. CGI.pm produces server error

4. regexp producing uninitialized var errors.

5. Error doing rsh from perl

6. += operator produces error, = operator doesn't?

7. Script error:"did not produce a valid header", but runs ok from command line

8. Error message.....Perl.exe did not produce a valid header

9. Need help with rsh error handling

10. print "@array" produces compiler error

11. Capturing rsh errors/ rup timeout

12. Capturing rsh errors; killing rup process

 

 
Powered by phpBB® Forum Software