[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Does [ -f FILE ] have a bug on testing a symlink ?
From: |
Cheng Rk |
Subject: |
Re: Does [ -f FILE ] have a bug on testing a symlink ? |
Date: |
Mon, 9 Feb 2015 22:57:49 +0000 (UTC) |
On Monday, February 9, 2015 1:59 PM, Andreas Schwab <schwab@linux-m68k.org>
wrote:
>> According this documentation `help test`, I am expecting it should return
>> false on anything other than a regular file,
>>
>> -f FILE True if file exists and is a regular file.
>>
>>
>> but why it returned true on a symlink to a regular file?
> (bash) Bash Conditional Expressions::
Unless otherwise specified, primaries that operate on files follow
symbolic links and operate on the target of the link, rather than the
link itself.
> Andreas.
Then the builtin test help need a documentation fix, right?
For some purpose, I need to make sure the file is regular (like for creating
archives); will have to do something like this?
[ -f tmp/sym-link ] && {
[ -h tmp/sym-link ] && echo do something to break the symlink
}
do something to break link
- Does [ -f FILE ] have a bug on testing a symlink ?, Cheng Rk, 2015/02/09
- Re: Does [ -f FILE ] have a bug on testing a symlink ?, Chet Ramey, 2015/02/09
- Re: Does [ -f FILE ] have a bug on testing a symlink ?, Ken Irving, 2015/02/09
- Re: Does [ -f FILE ] have a bug on testing a symlink ?, Evan Gates, 2015/02/09
- Re: Does [ -f FILE ] have a bug on testing a symlink ?, Eric Blake, 2015/02/09
- Re: Does [ -f FILE ] have a bug on testing a symlink ?, Bob Proulx, 2015/02/09
- Re: Does [ -f FILE ] have a bug on testing a symlink ?, Andreas Schwab, 2015/02/09
- Re: Does [ -f FILE ] have a bug on testing a symlink ?,
Cheng Rk <=
Re: Does [ -f FILE ] have a bug on testing a symlink ?, Greg Wooledge, 2015/02/09
Re: Does [ -f FILE ] have a bug on testing a symlink ?, Geir Hauge, 2015/02/09