bug-bash
[Top][All Lists]
Advanced

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

Re: [Documentation] -d returns true for symlink to directory


From: Reuti
Subject: Re: [Documentation] -d returns true for symlink to directory
Date: Thu, 21 Jul 2016 15:41:39 +0200

Hi,

> Am 21.07.2016 um 01:43 schrieb Adam McKenna <address@hidden>:
> 
> BASH Man page conditional expressions:
> 
>        -d file
>               True if file exists and is a directory.
> 
> This is also stated at https://www.gnu.org/software/bash/manual/bashref.html
> 
> The operator also returns True if the file exists and is a symlink to a 
> directory
> 
> -bash-4.1$ file foo
> foo: directory
> -bash-4.1$ file bar
> bar: symbolic link to `foo'
> -bash-4.1$ if [ -d bar ]; then echo "bar is a directory"; fi
> bar is a directory
> -bash-4.1$ if [ -h bar ]; then echo "bar is a symlink"; fi
> bar is a symlink
> -bash-4.1$ bash -version
> GNU bash, version 4.1.2(1)-release (x86_64-redhat-linux-gnu)
> Copyright (C) 2009 Free Software Foundation, Inc.
> License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
> 
> This is free software; you are free to change and redistribute it.
> There is NO WARRANTY, to the extent permitted by law.
> 
> If this is intended behavior, the manual page and other documentation should 
> be updated to reflect it.

There is a line above the list in the man page:

"Unless otherwise specified, primaries that operate on files follow symbolic 
links and operate on the target of the link, rather than the link itself."

-- Reuti


reply via email to

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