Hi
In rather unfortunate situation I found that /usr/bin/test
gives false positive results when asked to test file types when no argument
(null value) is supplied. Eg:
# if [ -d ${file} ]; then echo success; fi
success
#
# echo ~${file}~
~~
# [ -d ${file} ]; echo $?
0
#
# /usr/bin/test
Maciek Olczak [EMAIL PROTECTED] writes:
# echo ~${file}~
~~
# [ -d ${file} ]; echo $?
0
POSIX requires this behavior. POSIX says that the shell command
`[ FOO ]' exits true (status 0) if FOO is not null, false (status
1) otherwise. In this case FOO is -d, which is not null, so
`[ -d ]'