Are you running inside bash? man bash
for the full details.
Basically, wildcard expansion is done by the shell in unix, not by the commands themselves. Let's say that I have four files, a
, b
, c
and d
in my folder. set -x
tells bash to echo the command it is actually going to attempt to run after it has munged what you typed, so we'll use that here.
$ set -x
$ echo *
+ echo a b c d
a b c d
That line starting +
is printed by bash: bash actually passes a b c d
to echo
. echo
never sees the *
you typed.
$ echo "*"
+ echo '*'
*
This time you told bash not to do filename expansion on the *
by quoting it. Thus echo
now sees the *
.
As for your original query, try
grep FOO '/path/to/files with spaces/'*