test binary

Kenneth J Vojtech <[email protected]> Thu, 21 Jul 2005 12:22:50 -0700
Newsgroups gmane.comp.gnu.core-utils.bugs,gmane.comp.gnu.sh-utils.bugs
Message-ID <OFF8736246.47E4F84B-ON85257045.006129CC-07257045.006A76AA@csc.com>



In zLinux for o/s390 (SuSe v 8 64 bit) is a binary 'test' that we use to
test for the existence of files.  One of our tests uses a wildcard to check
for any *.hdr files in a certain directory.  When there is more than one
*.hdr file in this directory, the test fails with an exit 2, so we are not
processing any files.  Is there an option that will allow the test command
to end with exit 0 if multiple files are found?  Or is this a bug?

We are using the test command on aix v 5.2 to process multiple files with
no problems.

Example of failure:
maestro@lnxrzp1:~/tmp> touch `date +%m%d%y%H%M%S`.hdr
maestro@lnxrzp1:~/tmp> ls -al
total 2
drwxrwxrwx    2 maestro  unison         80 2005-07-21 10:54 .
drwxr-xr-x   28 maestro  unison       1520 2005-07-21 09:22 ..
-rw-r--r--    1 maestro  unison          0 2005-07-21 10:54
072105105406.hdr
maestro@lnxrzp1:~/tmp> test -e *.hdr
maestro@lnxrzp1:~/tmp> echo $?
0
maestro@lnxrzp1:~/tmp> touch `date +%m%d%y%H%M%S`.hdr
maestro@lnxrzp1:~/tmp> ls -al
total 2
drwxrwxrwx    2 maestro  unison        112 2005-07-21 10:54 .
drwxr-xr-x   28 maestro  unison       1520 2005-07-21 09:22 ..
-rw-r--r--    1 maestro  unison          0 2005-07-21 10:54
072105105406.hdr
-rw-r--r--    1 maestro  unison          0 2005-07-21 10:54
072105105448.hdr
maestro@lnxrzp1:~/tmp> test -e *.hdr
-sh: test: too many arguments
maestro@lnxrzp1:~/tmp> echo $?
2
maestro@lnxrzp1:~/tmp> touch `date +%m%d%y%H%M%S`.hdr
maestro@lnxrzp1:~/tmp> ls -al
total 2
drwxrwxrwx    2 maestro  unison        144 2005-07-21 10:55 .
drwxr-xr-x   28 maestro  unison       1520 2005-07-21 09:22 ..
-rw-r--r--    1 maestro  unison          0 2005-07-21 10:54
072105105406.hdr
-rw-r--r--    1 maestro  unison          0 2005-07-21 10:54
072105105448.hdr
-rw-r--r--    1 maestro  unison          0 2005-07-21 10:55
072105105534.hdr
maestro@lnxrzp1:~/tmp> test -e *.hdr
-sh: test: too many arguments
maestro@lnxrzp1:~/tmp> echo $?
2
maestro@lnxrzp1:~/tmp> ls -l /usr/bin/test
-rwxr-xr-x    1 root     root        22912 2003-06-28 21:18 /usr/bin/test
maestro@lnxrzp1:~/tmp> file /usr/bin/test
/usr/bin/test: ELF 64-bit MSB executable, version 1 (SYSV), dynamically
linked (
uses shared libs), stripped


Any feedback is appreciated

Regards,
kv