Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Bad file description for win32/bash/perl combo

( #11749=categorized question: print w/ replies, xml ) Need Help??
Contributed by Coyo on May 16, 2000 at 00:56 UTC
Q&A  > input and output


Description:

bash$ perl -e '`find > foo`; print \"$!\n\";'

gives me the following output

Bad file descriptor

I can run `find` fine, as long as I don't pipe it or redirect output.

I run the following in Bash version 2.021 with Perl 5.6.0 build 613 on NT 4.00.1381 (4.0) with Service Pack 5.

No file redirection or piping seems to work.

-coyo (running NT due to a past life karma debt, no doubt)

Answer: Bad file description for win32/bash/perl combo
contributed by Coyo

Too many files!

Well, I may not have answered the question, but I have found that even putting too large of a string into a backtick operation causes the 'Bad file descriptor' error.

`wc $lots_of_files`;
does not work. It can be broken up so to be made to work:
@lots_of_files = split($lots_of_files);

$third = $#lots_of_files;

$a = join(' ', @lots_of_files [0..$third] );

$a = join(' ', @lots_of_files [1+$third..2*third]);

$a = join(' ', @lots_of_files [1+2*$third..$#lots_of_files] );

`wc $a`;

`wc $b`;

`wc $c`;

Well, that seems to work. It doesn't explain why redirection is failing for me in just about all cases though.

Maybe this is usefull to someone.

-coyo

Please (register and) log in if you wish to add an answer



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others drinking their drinks and smoking their pipes about the Monastery: (3)
    As of 2014-09-20 15:03 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (160 votes), past polls