solaris8 viewer wrapper Scripting puzzle

Cameron Simpson cs "at" zip.com.au
Fri, 11 Jan 2002 04:17:53 +0000


On 22:47 10 Jan 2002, Shing-Fat Fred Ma <fma "at" doe.carleton.ca> wrote:
| Here's a puzzle I've been ignoring for the last while.  I wrote a
| trivial wrapper script "vncv":
| 
|      #!/bin/csh -f

Step 1: Use /bin/sh like any sane programmer :-(

| which I invoke using
|      vncv -encodings \"tight copyrect\" SomeServerHostMachine.blah.bleh.ca:1

This is very bogus. You are passing _FOUR_ arguments here:

	-encodings
	"tight
	copyrect"
	SomeServerHostMachine.blah.bleh.ca:1

What you really want is to say:

	vncv -encoding "tight encoding" SomeServerHostMachine.blah.bleh.ca:1

which passes three arguments:

	-encode
	tight encoding
	SomeServerHostMachine.blah.bleh.ca:1

Then just have the script not screw up:

	#!/bin/sh
	exec vncviewer -owncmap -noshared ${1+"$@"}

| On my system, it appears that the escaped
| double quotes have been made to be a permanent part of the argument,

Of course they are. In fact, part of two arguments (see above).

| though one would expect them to be done away with after variable expansion.

Why? You escaped them: they're not quoting (punctuation) characters any
more, they're just [... dramatic pause ...] characters.
-- 
Cameron Simpson, DoD#743        cs "at" zip.com.au    http://www.zip.com.au/~cs/

Your eyes are weary from staring at the CRT.  You feel sleepy.  Notice how
restful it is to watch the cursor blink.  Close your eyes.  The opinions
stated above are yours.  You cannot imagine why you ever felt otherwise.
	- gabrielh "at" tplrd.tpl.oz.au
---------------------------------------------------------------------
To unsubscribe, mail majordomo "at" uk.research.att.com with the line:
'unsubscribe vnc-list' in the message BODY
See also: http://www.uk.research.att.com/vnc/intouch.html
---------------------------------------------------------------------