Generated or received a file descriptor number that is not valid 
Author Message
 Generated or received a file descriptor number that is not valid

Mahesh Asolkar wrote ..

Quote:
>I have a couple of small perl scripts...

>One is exec.pl ...

>#!/usr/local/bin/perl -w

>my $CmdStr1 = "my.pl > lst1";
>my $CmdStr2 = "my.pl >& lst2";

>system ("$CmdStr1");
>system ("$CmdStr2");

>.. and other my.pl ...

>#!/usr/local/bin/perl -w

>print "An STDOUT String1\n";
>print STDERR "An STDERR String2\n";
>print "An STDOUT String3\n";
>print STDERR "An STDERR String4\n";

>Upon executing exec.pl, these are the responses that I get on two
>versions of perl (on two different OSs).

>On perl version 5.005_03 built for i386-linux, (Exactly the way I want)

>An STDERR String2
>An STDERR String4

>(Lst1 has only the STDOUT messages & Lst2 has both STDERR & STDOUT
>messages)

>And on perl v5.6.0 built for 9000/777-hpux, (Error. Functionality, not
>as desired)

>An STDERR String2
>An STDERR String4
>sh: lst2: Generated or received a file descriptor number that is not valid.

>(Lst1 has only the STDOUT messages. Script exits before generating Lst2
>due to an error)
>------------------------------------------------------------------------

>I think the problem lies in the '&' in $CmdStr2. If that is removed,
>all's well - except the functionality - because I want all the STDERR
>& STDOUT messages to go into the lst files. Is there any way I can get
>response on v5.6.0 similar to the 5.005_03?

>I have an idea that perl 5.6.0 treats file descriptors differently as
>compared to its predecessors - as real variables. But I am not sure if
>this problem is related to that fact.

the problem has nothing to do with which version of Perl you're using ..
it has only to do with the differences in the two shells .. look at the
error

  sh: lst2: Generated or received a file descriptor number that is not
            valid.

that's an error from the shell (hence the 'sh:' prefix) .. what this
means is that the shell on the HPUX machine handles file descriptors
differently to the Linux shell

to be honest - I've never seen that >& shorthand syntax .. you might
wanna check out the FAQ on STDERR .. it probably has an answer that
works on both shells

  perldoc -q STDERR

--



Tue, 28 Jan 2003 03:00:00 GMT  
 Generated or received a file descriptor number that is not valid

Quote:
>to be honest - I've never seen that >& shorthand syntax .. you might
>wanna check out the FAQ on STDERR .. it probably has an answer that
>works on both shells

An accurate error message would have been:
  sh: Cannot parse csh syntax

Quote:
>From csh and tcsh, the syntax is

        command args >& combined_STDOUT_and_STDERR
This is what a {t,}csh user would use from the command line.

Quote:
>From sh and related shells, the syntax is

        command args > combined_STDOUT_and_STDERR 2>&1
This is what the has to be used in the system("...") call.
                -Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.


Wed, 29 Jan 2003 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Help : How to manage fields with 'Illegal Name' ?

2. Generated or received a file descriptor number that is not valid

3. sh: lst2: Generated or received a file descriptor number that is not valid

4. Generated or received a file descriptor number that is not va lid

5. Adding a row with a TDBGrid?

6. Pirate CD Software for Sale

7. Problem with UPPER() sql and BDE.

8. **URGENT** Finding the number of open file descriptors using perl

9. how to open file descriptor by number?

10. CGI.pm isn't generating valid headers?

11. A Form can only have 4 DBLookupCombo???

12. Net::Ping/Socket chokes on valid IP numbers

 

 
Powered by phpBB® Forum Software