bug-bash
[Top][All Lists]
Advanced

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

[Documentation] -d returns true for symlink to directory


From: Adam McKenna
Subject: [Documentation] -d returns true for symlink to directory
Date: Wed, 20 Jul 2016 16:43:13 -0700

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.

Thanks.

reply via email to

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