bug-bash
[Top][All Lists]
Advanced

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

Re: Does [ -f FILE ] have a bug on testing a symlink ?


From: Andreas Schwab
Subject: Re: Does [ -f FILE ] have a bug on testing a symlink ?
Date: Mon, 09 Feb 2015 22:59:50 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

Cheng Rk <crquan@ymail.com> writes:

> 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.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."



reply via email to

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