Article View: bit.listserv.script-l
Article #402Re: How to test a variable
From: Benjamin Chi
Date: Thu, 03 Mar 1994 06:02
Date: Thu, 03 Mar 1994 06:02
33 lines
2300 bytes
2300 bytes
A couple of days ago I wrote:
>I have a situation where if variable vvv contains the string "XXX" I want
>one thing to happen; if it contains anything else (say, "YYY ZZZ") I want
>something else to happen. How do I perform this test?
>
>.se vvv = 'XXX'
>.if &vvv = XXX;.th FOO;.el BAR
>.if XXX = &vvv;.th FOO;.el BAR
>
>gives FOO BAR when processed by SCRIPT; I should think it would give
>FOO FOO . If I replace the first statement with
>
>.se vvv = 'YYY ZZZ'
>
>then I get the diagnostic statement
>INVALID KEYWORD FOR CONDITION ON .IF.
>'TRY' LINE 3: .if YYY ZZZ = XXX;.th FOO;.el BAR
>(which I understand), and still FOO BAR as output.
>
>Questions:
>(1) Why aren't the two .if statements in either of the two examples
>entirely equivalent?
>(1a) Why didn't I get the same diagnostic for line 2 of the second
>example?
>(2) What is the syntactically correct way to test the contents of a
>variable whose value may be a string with embedded spaces?
Mark Lawrence at Stanford was kind enough to reply with some suggestions
about how to get these tests to succeed. Unfortunately he tested them
with Waterloo Script, whereas the problem I am having is with use of
DCF 4.0 for which his suggestions provide no relief. Anybody else have
any ideas?
/b
Technical Details
Message-ID:
<940303.010234.EST.BEC@albany.edu>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!zib-berlin.de!netmbx.de!Germany.EU.net!EU.net!howland.reston.ans.net!paladin.american.edu!auvm!ALBANY.EDU!BECShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11353d,2be3885144b57674 X-Google-Attributes: gid11353d,public X-Google-ArrivalTime: 1994-03-02 22:02:34 PST Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!zib-berlin.de!netmbx.de!Germany.EU.net!EU.net!howland.reston.ans.net!paladin.american.edu!auvm!ALBANY.EDU!BEC Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU Newsgroups: bit.listserv.script-l Return-Path: <@AUVM.AMERICAN.EDU,@UGA.CC.UGA.EDU:owner-script-l@UGA.CC.UGA.EDU> Return-Path: <@UGA.CC.UGA.EDU,@UACSC2.ALBANY.EDU:BEC@UACSC2.ALBANY.EDU> X-Acknowledge-To: <BEC@albany.edu> Message-ID: <940303.010234.EST.BEC@albany.edu> Date: Thu, 3 Mar 1994 01:02:34 EST Sender: IBM vs Waterloo SCRIPT discussion group <SCRIPT-L@UGA.BITNET> From: Benjamin Chi <BEC@ALBANY.EDU> Organization: University at Albany Computing and Network Services Subject: Re: How to test a variable In-Reply-To: Message of Wed, 2 Mar 1994 10:48:03 PST from <M.Lawrence@STANFORD> Lines: 32