[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [FYI] {master} maint: assume 'test -x' is portable
From: |
Keith Marshall |
Subject: |
Re: [FYI] {master} maint: assume 'test -x' is portable |
Date: |
Mon, 27 Feb 2012 14:53:40 +0000 |
On 27 February 2012 13:58, Eric Blake wrote:
> I'm also interested in the behavior of the following (which is what I
> have proposed that autoconf adds to all configure scripts, and will fail
> if it cannot find a shell that claims to work):
>
> test -x /; echo $?
> test -x .; echo $?
> printf '#!/bin/sh\nexit 0\n' > foo.sh
> ./foo.sh; echo $?
> test -x foo.sh; echo $?
> chmod a+x foo.sh; echo $?
> ./foo.sh; echo $?
> test -x foo.sh; echo $?
>
> Once I know those behaviors, I think I can ensure that my proposed test
> to require a "working" 'test -x' as a pre-req of finding a sane shell
> should still work for MSYS.
$ uname -a
MINGW32_NT-6.0 ... 1.0.17(0.48/3/2) 2011-04-24 23:39 i686 Msys
$ cat <<\EOF> bar.sh
> test -x /; echo $?
> test -x .; echo $?
> printf '#!/bin/sh\nexit 0\n' > foo.sh
> ./foo.sh; echo $?
> test -x foo.sh; echo $?
> chmod a+x foo.sh; echo $?
> ./foo.sh; echo $?
> test -x foo.sh; echo $?
> EOF
$ sh -v bar.sh
test -x /; echo $?
0
test -x .; echo $?
0
printf '#!/bin/sh\nexit 0\n' > foo.sh
./foo.sh; echo $?
0
test -x foo.sh; echo $?
0
chmod a+x foo.sh; echo $?
0
./foo.sh; echo $?
0
test -x foo.sh; echo $?
0
--
Regards,
Keith.
- Re: [FYI] {master} maint: assume 'test -x' is portable, (continued)
Re: [FYI] {master} maint: assume 'test -x' is portable, Peter Rosin, 2012/02/26
Re: [FYI] {master} maint: assume 'test -x' is portable, Keith Marshall, 2012/02/27