Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This will be an easy one, but in my memories, when shell scripting, using double quotes would allow expanding globbing and variables.

But in the following code:


echo *.sh
echo "*.sh"
echo '*.sh'

echo $LANG
echo "$LANG"
echo '$LANG'

I get this result:

bob.sh redeployJboss.sh

So single quoting prevent glob AND variable expansion but double quoting allows only variable expansion and no globbing?

Can I glob in any quoting pattern?

share|improve this question
up vote 9 down vote accepted

You are correct: globbing doesn't work in either single- or double-quotes. However, you can interpolate globbing with double-quoted strings:

$ echo "hello world" *.sh "goodbye world"
hello world [list of files] goodbye world
share|improve this answer
Or even echo "$hello and $goodbye".* (mix variable expansions, spaces, and a glob in the same "word". – vonbrand Mar 13 '13 at 13:57
Globbing doesn't seem to work in this case, echo /path/to/file/*${variable}. How do I glob while appending an interpolated email? – CMCDragonkai Feb 5 at 7:36
@CMCDragonkai echo "$FOLDER_PATH"/*.extension works fine for me, contrary to the accepted answer, I had to remove the whitespace between the " and the *. Hope it helps. – LostBalloon Mar 10 at 18:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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