Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Feb 2010 23:21:19 -0800
From:      Nerius Landys <nlandys@gmail.com>
To:        Eray Aslan <eray.aslan@caf.com.tr>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: simple (and stupid) shell scripting question
Message-ID:  <560f92641002142321s246f15fcg6f233b0c152e1d6a@mail.gmail.com>
In-Reply-To: <4B78EFCC.2010102@caf.com.tr>
References:  <560f92641002142207w7eade79fr6a4f40ae5b92f4b9@mail.gmail.com> <4B78EFCC.2010102@caf.com.tr>

next in thread | previous in thread | raw e-mail | index | archive | help
> >From the man page:
>
> Command Substitution
> [...]
> =A0If =A0the =A0substitution =A0appears within double quotes, word splitt=
ing and
> =A0 =A0 =A0 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=3D`ls`

vs

FOO=3D"`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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?560f92641002142321s246f15fcg6f233b0c152e1d6a>