delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/08/26/09:36:29

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <3F4B6241.7030607@sanger.ac.uk>
Date: Tue, 26 Aug 2003 14:36:01 +0100
From: Rob Clack <rnc AT sanger DOT ac DOT uk>
Organization: Sanger Institute
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.2.1) Gecko/20030326
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: "Gerrit @ cygwin" <cygwin AT cygwin DOT com>
Subject: Re: perl test fails
References: <3F3CAEFF DOT 6080604 AT sanger DOT ac DOT uk> <22-1834747748 DOT 20030816001704 AT familiehaase DOT de>
In-Reply-To: <22-1834747748.20030816001704@familiehaase.de>

Gerrit

I've been away for a week, hence the delayed response.

Thanks for this and clearly my scriptlet was broken.  I've now tried 
both alternatives as suggested below.  Both work perfectly under Linux. 
  Neither works under NT4.

Linux output:

script is executable

NT4 output:

I damn well am!

To eliminate error further, I'm now running just one copy of the script, 
since the disk I use on my Linux box is mapped to the i: drive on the 
NT4 box.

Strange it seems to work correctly for you but not for me.

Regards
Rob


Gerrit P. Haase wrote:
> 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

-- 
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Opportunities always look bigger going than coming.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Rob Clack                        Acedb Development,  Informatics Group
  email: rnc AT sanger DOT ac DOT uk                Wellcome Trust Sanger Institute
  Tel: +44 1223 494780                   Wellcome Trust Genome Campus
  Fax: +44 1223 494919                   Hinxton  Cambridge    CB10 1SA


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019