bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is this a bug in [[ -f ]]?


From: Steven W. Orr
Subject: Is this a bug in [[ -f ]]?
Date: Thu, 18 Aug 2011 12:35:37 -0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.20) Gecko/20110804 Thunderbird/3.1.12

I have a symlink file and if if I test it I get success status with -f.

831 > ls -l errio err
lrwxrwxrwx. 1 sorr fc    5 Aug 18 08:48 err -> errio
-rw-rw-r--. 1 sorr fc 3816 Aug 18 08:48 errio
832 > [[ -f errio ]]
833 > echo $?                # Good answer
0
*834 > [[ -h errio ]]
835 > echo $?                # Good answer
1
*836 > [[ -f err ]]
837 > echo $?                # BAD answer
0
*838 > [[ -h err ]]  # Good answer
839 > echo $?
0

The man page says that -f should succeed if it exists and it's a regular file.

GNU bash, version 4.0.35(1)-release (x86_64-redhat-linux-gnu)

Is this a bug? Is there a workaround? Am I doing something wrong?

TIA

--
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



reply via email to

[Prev in Thread] Current Thread [Next in Thread]