[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug in [ -d ... ] ?
From: |
Chet Ramey |
Subject: |
Re: Bug in [ -d ... ] ? |
Date: |
Thu, 2 Nov 2017 11:09:56 -0400 |
User-agent: |
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
On 11/2/17 7:03 AM, Michael F Gordon wrote:
> Can anyone explain the following?
>
> tla19> set|grep FOOFOOFOO
> tla19> if [ -d ${FOOFOOFOO:=""} ]; then echo YES;fi
> YES
> tla19> echo $BASH_VERSION
> 4.4.12(1)-release
Greg is correct. This expands to [ -d ], which is true. There was an
expansion bug in bash-4.1 that caused ${FOOFOOFOO:=""} to expand to the
empty string, but that was fixed almost eight years ago as the result of
http://www.austingroupbugs.net/view.php?id=221
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/