Subject: RE: (s)hell quoting (s)hell
To: None <netbsd-users@netbsd.org>
From: Schwerzmann, Stephan <stephan.schwerzmann@schmid-telecom.ch>
List: netbsd-users
Date: 03/02/2006 11:13:07
> -----Original Message-----
> From: matthew sporleder [mailto:msporleder@gmail.com]=20
> Sent: Mittwoch, 1. M=E4rz 2006 16:08
> To: Schwerzmann, Stephan
> Cc: netbsd-users@netbsd.org
> Subject: Re: (s)hell quoting (s)hell
>=20
>=20
> For more questions of this nature, buy the follow book:=20
> http://www.oreilly.com/catalog/upt3/index.html
>=20
> I'm not sure how bash works specifically, but here's netbsd's=20
> sh in action:
>=20
> gomez$ cat test.sh
> #!/bin/sh
> var=3D\"\"
> echo ${var}
> gomez$ ./test.sh
> ""
>=20
thanks Matthew, but this does not help.
there is a difference between echo ${var} and ${var} !!!
$ TOOL=3D'find . -name "" '
$ echo $TOOL
find . -name ""
$ set -x ; ${TOOL} ; set +x
+ find . -name '""'
+ set +x
$
continuing on this, it seems that eval might help me
$ set -x ; eval "${TOOL}" ; set +x
+ eval 'find . -name "" '
++ find . -name ''
+ set +x
$
well, the dbl.quotes get _replaced_ by single quotes,=20
which seems to be equivalent and not to trouble further.
I have to see wheter I can deploy that in my script,
but I'm not happy: this involves the discipline to think=20
about and decide whether an eval is necessary bevore a=20
command.
I don't like to run a collection of variants for how commands=20
need to be called...
then using eval systematically at every command call feels
clumsy saying the least.
- - -
I'll throw an eye on that "Unix Power Tools" book.
For s'hell'ish things I mostly use
<http://www.unix.org.ua/orelly/unix/ksh/index.htm>
<http://www.tldp.org/LDP/abs/html/>
Stephan