solaris8 viewer wrapper Scripting puzzle

Shing-Fat Fred Ma fma "at" doe.carleton.ca
Fri, 11 Jan 2002 14:46:17 +0000


Yes, you're right.  It is bogus.  It doesn't work.  I was trying
to figure out why.  Leaving out the backslashes was the first
thing I did.  Of course, that didn't work either, because by the
time vncviewer is invoked, the quotes are gone.  Single quotes
don't work either.  Escaping the quotes keeps them there for
the line in which the vncviewer is invoked, by which time the
backslashes are gone.  At that point, they are indeed just
characters, and the whole line should be exactly as if I had
typed it in from the keyboard.  In fact, itt works if I just type it in
from the keyboard.

Anyway, point well taken about csh.  People have bugged me
to learn bash, which I am doing slowly but surely.  And I've
had to pick up a few others, albeit just enough to make things
go wrong rather than right.  Preferrably, I can figure out the
problem rather than learn another new shell.  Otherwise, I just keep
running from shell to shell.  In this case, it's not that urgent.

Fred
--------------------------------------------------------------------------
Fred Ma
Department of Electronics
Carleton University, Mackenzie Building
1125 Colonel By Drive
Ottawa, Ontario
Canada     K1S 5B6
fma "at" doe.carleton.ca
==========================================================================



> Date: Fri, 11 Jan 2002 15:15:30 +1100
> From: Cameron Simpson <cs "at" zip.com.au>
> Subject: Re: solaris8 viewer wrapper Scripting puzzle
>
> 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
---------------------------------------------------------------------