simple (and stupid) shell scripting question
Nerius Landys
nlandys at gmail.com
Mon Feb 15 07:21:22 UTC 2010
> >From the man page:
>
> Command Substitution
> [...]
> If the substitution appears within double quotes, word splitting and
> pathname expansion are not performed on the results.
>
> In other words:
>
> sh-4.0$ touch "x y"
> sh-4.0$ for i in `ls`; do echo "$i"; done
> x
> y
> sh-4.0$ for i in "`ls`"; do echo "$i"; done
> x y
> sh-4.0$
But in the case where you're assigning the output of ls directly to a
variable like this:
FOO=`ls`
vs
FOO="`ls`"
the text assigned to FOO is the same, right?
I know that later if you do
for f in $FOO; do
done
it's different from
for f in "$FOO"; do
done
that much is clear.
More information about the freebsd-questions
mailing list