Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Message-ID: <3F3CAEFF.6080604@sanger.ac.uk>
Date: Fri, 15 Aug 2003 10:59:27 +0100
From: Rob Clack <rnc@sanger.ac.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: cygwin@cygwin.com
Subject: perl test fails
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

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.

Thanks
Rob

-----------------------------------------------------------------------
#!/usr/bin/perl
# this is the perl script, called "try"

if ( -x script)
{
	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@ramsey ~
$ ./try
I damn well am!

rnc@ramsey ~
-----------------------------------------------------------------------
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  My idea of housework is to sweep the room with a glance.
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  Rob Clack                        Acedb Development,  Informatics Group
  email: rnc@sanger.ac.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/

