Subject: Re: (s)hell quoting (s)hell
To: Schwerzmann, Stephan <stephan.schwerzmann@schmid-telecom.ch>
From: Alexander Mayer <mayerale@weihenstephan.org>
List: netbsd-users
Date: 03/02/2006 14:15:45
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


On 02.03.2006, at 11:13, Schwerzmann, Stephan wrote:

> $ set -x ; eval "${TOOL}" ; set +x
> + eval 'find . -name "" '
> ++ find . -name ''
> + set +x
> $

"eval" is exactly what you need. The shell doesn't evaluate quotings, 
substitutions or what ever _after_ variable substitution. Only word 
splitting is performed.

> well, the dbl.quotes get _replaced_ by single quotes,
> which seems to be equivalent and not to trouble further.

The double quotes are not replaced. Think about debugging with "set 
- -x". The shell want's to show you the _result_ of all substitutions, 
quotings and so on. For example:

$ x='$x'
$ echo $x
$x
$ set -x; echo $x; set +x
+ echo '$x'

Double quotes wouldn't be correct.

Hope, that helps.

Alex
- --
My GPG public key:
http://www.weihenstephan.org/~mayerale/pgp/AlexanderMayer.gpg.asc
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFEBvALBF+abY4YMw8RAnMZAJ4jjzLzL5kN+oIHbU7pZjI+WSt69gCeK+cx
nvadJjEZj+MZkttxs1Kgmbw=
=fDYu
-----END PGP SIGNATURE-----