Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

On a "standard BASH" does a wildcard inside double-quotes glob? For example:

$ touch abc
$ ls "*abc*"

would that, or wouldn't that work on bash?

I was told Ubuntu shipped with a bash variant that doesn't conform to POSIX or BASH. Is that true?

share|improve this question

closed as off topic by studiohack Aug 3 '11 at 23:37

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
Which question would you like answered first? –  Ignacio Vazquez-Abrams Aug 3 '11 at 21:52
    
...................Both –  Matt Aug 3 '11 at 22:13
    
For the record, it is better to ask one question at a time (maybe that's what Ignacio meant). –  slhck Aug 3 '11 at 22:37

1 Answer 1

up vote 5 down vote accepted

Short answer: no

Long answer from man bash:

Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of $, `, \

So:

~$ touch sas
~$ ls *a*
sas
~$ ls "*a*"
ls: cannot access *a*: No such file or directory

Of course when talking about double quotes and asterisks there is another exception: parameter expansion (ie: "$*") ...but that's another history

For the second question: are you asking about dash? dash is a lightweight shell for scripts. In debian, and in ubuntu per extension (as is debian based), is aliased to sh; It's major advantage over bash is its speed, so it is used by default for system scripts; however bash is still available as the interactive shell for users by default

 ~$ ls -l /bin/sh 
lrwxrwxrwx 1 root root 4 2011-04-21 11:54 /bin/sh -> dash
share|improve this answer
    
Ah.. Thanks. Yes, I was aware /bin/sh was aliased to dash. But anyway, someone I am talking to tells me this works on his Red Hat system [* globs when double quoted--he says the only way to be sure they do not glob is to use single quotes]. Any idea why? –  Matt Aug 3 '11 at 21:59
    
No, your friend is completely wrong - double check the quote from man bash I've posted in my answer. –  hmontoliu Aug 3 '11 at 22:02
    
I did not say he was my friend :P We were having a disagreement, and him being a "programmer for 11 years" and has a big job, and me who's just been learning from google and stuff, since I disagreed with him, this other person [who is a friend's friend --this other guy was his friend] started talking about how I should not be brushing aside his knowledge, because he, by far, was the most knowledgeable one in the discussion. But thanks! :) –  Matt Aug 3 '11 at 22:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.