Re: Does [ -f FILE ] have a bug on testing a symlink ?
From:
Evan Gates
Subject:
Re: Does [ -f FILE ] have a bug on testing a symlink ?
Date:
Mon, 9 Feb 2015 13:54:28 -0800
from bash(1):
Unless otherwise specified, primaries that operate on files follow
symbolic links and operate on the target of the link, rather than the
link itself.
On Mon, Feb 9, 2015 at 1:00 PM, Cheng Rk <crquan@ymail.com> wrote:
>
>
> To bug-bash@gnu.org:
>
>
> 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?
>
> $ [ -f tmp/sym-link ] && echo true
> true
>