Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-AuthUser: gerrit:koeln.convey.de Date: Sat, 16 Aug 2003 00:17:04 +0200 From: "Gerrit P. Haase" Reply-To: "Gerrit @ cygwin" Organization: Esse keine toten Tiere X-Priority: 3 (Normal) Message-ID: <22-1834747748.20030816001704@familiehaase.de> To: Rob Clack CC: cygwin AT cygwin DOT com Subject: Re: perl test fails In-Reply-To: <3F3CAEFF.6080604@sanger.ac.uk> References: <3F3CAEFF DOT 6080604 AT sanger DOT ac DOT uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hallo Rob, Am Freitag, 15. August 2003 um 11:59 schriebst du: > Not sure if this is the right list for my question. > cygwin 1.3.22-1 running under NT4. > I have a perl script that runs an executable, so before actually running > it, the code checks that the file exists and is executable, but the test > fails under cygwin. Under linux and OSF1 it's fine. > I cut out the relevant fragments and built a demo. The idea is that if > the "if ( -x script )" works correctly, then I should get "script is > executable" as output. Otherwise, it will execute the script, in which > case the output will be what the script prints. > Hope someone can tell me why -x doesn't work the way I'm expecting. > ----------------------------------------------------------------------- > #!/usr/bin/perl > # this is the perl script, called "try" > if ( -x script) ^^^^^^^^^^^^ barewords are obviously a problem here, I'm not sure if this really works under Linux, cannot test it here though. > { > print "script is executable"; > } > else > { > system("./script"); > } > ----------------------------------------------------------------------- > # This is the 'executable'. For the demo, it's just a script with +x > # permissions > echo "I damn well am!" > ----------------------------------------------------------------------- > # Here is the output I get > rnc AT ramsey ~ > $ ./try > I damn well am! #!/usr/bin/perl $filename = "script"; if ( -x $filename) { print "script is executable"; } else { system("./$filename"); } or #!/usr/bin/perl if ( -x "script") { print "script is executable"; } else { system("./script"); } are doing the right thing. Gerrit -- =^..^= -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/