Perl system() command failing under CYGWIN

Ask a Question related to PERL Miscellaneous, Design and Development.

  1. #1

    Default Perl system() command failing under CYGWIN

    Hi,
    I am trying to install a software product that uses Perl under CYGWIN
    and am having a problem with the Perl system() command failing.

    The following script works from a Windows 2000 cmd prompt:
    !#g:\perl\bin
    print "dir\n";
    system ( "dir");

    The following script run from the CYGWIN prompt (on the same PC),
    prints 'ls[return]' but fails to execute the 'system ("ls") command;
    no error is displayed it just skips over the system() line:
    !#g:/perl/bin
    print "ls\n";
    system("ls");

    Perl & Cygwin are supplied with the software, so I am hesitant to
    upgrade them. Perl is v5.005_002. PC is running Windows 2000 Server
    SP3 as recommended by the software supplier.

    I have tried the usual Google and mailing list archive searches with
    no luck. So, any suggestions are much appreciated.

    TIA,
    Gordon
    Gordon Guest

  2. Similar Questions and Discussions

    1. Installation problem - Net-SNMP Perl Modules on cygwin
      When Net-SNMP Perl modules are installed in cygwin $cd net-snmp5.2.1/perl $perl MakeFile.PL Writing Makefile for NetSNMP::default_store...
    2. Off Topic: Active Perl Native Windows / cygwin perl
      I have both activestate windows native perl installed and the default cygwin perl. How can I have the cygwin shell use the windows perl rather...
    3. Help: Install DBI-Oracle on cygwin with Perl 5.8.0
      Hi All: I am new in the Perl world. So far I have installed cygwin and Perl 5.8.0 along with Perl DBI and DBD::Oracle modules. NowI am trying to...
    4. Problem with the Perl System command
      Hi, I am facing an issue with the perl system command The relevant lines of code are the following: chdir "$util"; my @args =...
    5. Cplex hangs in Perl system command
      wei_zhao2000@hotmail.com (Wei) wrote in news:2673a9d5.0308041236.5d6b6c52 @posting.google.com: Does your C program close the CPLEX...
  3. #2

    Default Re: Perl system() command failing under CYGWIN

    On 10 Sep 2003 01:19:21 -0700, [email]gordonp@myrealbox.com[/email] (Gordon) wrote:
    >The following script run from the CYGWIN prompt (on the same PC),
    >prints 'ls[return]' but fails to execute the 'system ("ls") command;
    >no error is displayed it just skips over the system() line:
    >!#g:/perl/bin
    >print "ls\n";
    >system("ls");
    No, it works fine. Oh, you wanted to see the output?
    Then you don't want to use the system function,
    you want to use backticks or qx as specified in the
    perlFAQ:

    perlfaq -q "Why can't I get the output of a command with system()?"

    If your cygwin directory is not in path, you may need
    to supply the full path to ls. You will definitely have
    to do that if this is supposed to run as a CGI.

    You should also ALWAYS check external and
    system calls for errors with warn or die as appropriate!

    my $ls = 'C:/cygwin/bin/ls.exe';
    my $output = qx/$ls/ or die "Cannot run $ls:$!\n";
    print $output;
    >Perl & Cygwin are supplied with the software, so I am hesitant to
    >upgrade them. Perl is v5.005_002.
    Ancient. Do yourself a favour and upgrade.
    >I have tried the usual Google and mailing list archive searches with
    >no luck. So, any suggestions are much appreciated.
    perldoc comes first, Google later.
    Helgi Briem Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139