Re: A subst-antial question



Don Porter wrote:
% ::comm::comm send 51395 [list array set foo $pairs]

Let me restate the question. Suppose I have a script:

set script {
array set foo $pairs
set bar $somethingElse
}

This would typically have been passed into a procedure instead of set
literally, where "pairs" and "somethingElse" would be defined in the
caller's context. I want to be able to run the same script either
locally or remotely. No preprocessing is necessary to run it locally.
I know I have to substitute variables locally before I can set them
remotely, and a simple [subst] won't do it. I don't think
[list]-ifying it in the caller's context, as you suggest, will work
either, because it'd lose the whitespace command delimiters. I could
process each line, substituting each word on the line and preserving it
as a single word, then reassembling the substituted script, but is that
the only way?

I may have oversimplified things in my original posting by using a
single-line script... sorry!

.



Relevant Pages

  • Re: failed substitution
    ... I wrote a short script ... extension) and substitute it for '_a'. ... the foreach code can at least be shortened to: ... on the full path and not the basename. ...
    (perl.beginners)
  • Re: Error on "cryptorati.com" - adacrypt
    ... Her substitute was modern, cognitive, and yells along with the ... script. ...
    (sci.crypt)
  • Re: A subst-antial question
    ... I want to be able to run the same script either ... I know I have to substitute variables locally before I can set them ... -ifying it in the caller's context, as you suggest, will work ... not-so-arbitrary script can be executed in another interpreter. ...
    (comp.lang.tcl)
  • Re: failed substitution
    ... I have a number of jpegs I wanted to rename. ... I wrote a short script ... extension) and substitute it for '_a'. ... This makes the malfunction dependent from the contents in $dir. ...
    (perl.beginners)
  • Question on perl script.
    ... I am very new to the perl language and don't know much about it. ... two values are being passed to this script. ... The perl command processes the inrptfile by substituting the first line ... How can I make it substitute something completely different ...
    (comp.unix.shell)