-d foo-* within single and double square brackets [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite













This question already has an answer here:



  • In a Bash if condition, how to check whether any files matching a simple wildcard expression exist?

    3 answers



  • What is the difference between [[ $a == z* ]] and [ $a == z* ]?

    3 answers



I just discovered that in bash,[[ -d foo-* ]] returns false ($? set to 1) even if a directory named foo-bar exists while [ -d foo-* ] returns true ($? set to 0)



I have to admit that I was surprised as I expected both versions to return true.



What is the rational behind this differing outcome?







share|improve this question












marked as duplicate by Kusalananda bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Feb 16 at 7:47


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    See also the bash manual about [[ ... ]] where it says "Word splitting and pathname expansion are not performed on the words between the [[ and ]]".
    – Kusalananda
    Feb 16 at 7:56










  • I missed that. Thanks for the clarification.
    – René Nyffenegger
    Feb 16 at 9:51














up vote
0
down vote

favorite













This question already has an answer here:



  • In a Bash if condition, how to check whether any files matching a simple wildcard expression exist?

    3 answers



  • What is the difference between [[ $a == z* ]] and [ $a == z* ]?

    3 answers



I just discovered that in bash,[[ -d foo-* ]] returns false ($? set to 1) even if a directory named foo-bar exists while [ -d foo-* ] returns true ($? set to 0)



I have to admit that I was surprised as I expected both versions to return true.



What is the rational behind this differing outcome?







share|improve this question












marked as duplicate by Kusalananda bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Feb 16 at 7:47


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1




    See also the bash manual about [[ ... ]] where it says "Word splitting and pathname expansion are not performed on the words between the [[ and ]]".
    – Kusalananda
    Feb 16 at 7:56










  • I missed that. Thanks for the clarification.
    – René Nyffenegger
    Feb 16 at 9:51












up vote
0
down vote

favorite









up vote
0
down vote

favorite












This question already has an answer here:



  • In a Bash if condition, how to check whether any files matching a simple wildcard expression exist?

    3 answers



  • What is the difference between [[ $a == z* ]] and [ $a == z* ]?

    3 answers



I just discovered that in bash,[[ -d foo-* ]] returns false ($? set to 1) even if a directory named foo-bar exists while [ -d foo-* ] returns true ($? set to 0)



I have to admit that I was surprised as I expected both versions to return true.



What is the rational behind this differing outcome?







share|improve this question













This question already has an answer here:



  • In a Bash if condition, how to check whether any files matching a simple wildcard expression exist?

    3 answers



  • What is the difference between [[ $a == z* ]] and [ $a == z* ]?

    3 answers



I just discovered that in bash,[[ -d foo-* ]] returns false ($? set to 1) even if a directory named foo-bar exists while [ -d foo-* ] returns true ($? set to 0)



I have to admit that I was surprised as I expected both versions to return true.



What is the rational behind this differing outcome?





This question already has an answer here:



  • In a Bash if condition, how to check whether any files matching a simple wildcard expression exist?

    3 answers



  • What is the difference between [[ $a == z* ]] and [ $a == z* ]?

    3 answers









share|improve this question











share|improve this question




share|improve this question










asked Feb 16 at 7:33









René Nyffenegger

7751617




7751617




marked as duplicate by Kusalananda bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Feb 16 at 7:47


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by Kusalananda bash
Users with the  bash badge can single-handedly close bash questions as duplicates and reopen them as needed.

StackExchange.ready(function()
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function()
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function()
$hover.showInfoMessage('',
messageElement: $msg.clone().show(),
transient: false,
position: my: 'bottom left', at: 'top center', offsetTop: -7 ,
dismissable: false,
relativeToBody: true
);
,
function()
StackExchange.helpers.removeMessages();

);
);
);
Feb 16 at 7:47


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









  • 1




    See also the bash manual about [[ ... ]] where it says "Word splitting and pathname expansion are not performed on the words between the [[ and ]]".
    – Kusalananda
    Feb 16 at 7:56










  • I missed that. Thanks for the clarification.
    – René Nyffenegger
    Feb 16 at 9:51












  • 1




    See also the bash manual about [[ ... ]] where it says "Word splitting and pathname expansion are not performed on the words between the [[ and ]]".
    – Kusalananda
    Feb 16 at 7:56










  • I missed that. Thanks for the clarification.
    – René Nyffenegger
    Feb 16 at 9:51







1




1




See also the bash manual about [[ ... ]] where it says "Word splitting and pathname expansion are not performed on the words between the [[ and ]]".
– Kusalananda
Feb 16 at 7:56




See also the bash manual about [[ ... ]] where it says "Word splitting and pathname expansion are not performed on the words between the [[ and ]]".
– Kusalananda
Feb 16 at 7:56












I missed that. Thanks for the clarification.
– René Nyffenegger
Feb 16 at 9:51




I missed that. Thanks for the clarification.
– René Nyffenegger
Feb 16 at 9:51















active

oldest

votes






















active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay