Re: Can $1 be set in a script?



larryalk <nobody@xxxxxxxxxxx> wrote:
On Thu, 30 Mar 2006 13:44:57 -0900, floyd@xxxxxxxxxx (Floyd L.
Davidson) wrote:
larryalk <nobody@xxxxxxxxxxx> wrote:

To be clearer, assuming a script called with or without a $1
how can I can assign the (possibly non-existant) $1 to something?

Ahem..., you said set $1 to something, and I'm saying set
something to $1 and then use $something everywhere in your
script that you would have used $1.

....

Thanks for your answer Floyd and I apologize for still being unclear.

No, you were quite clear! But I am suggesting that you should
*not* do what you have stated that you want to do. I don't see
that as the "right" thing to do...

Whether $1 and $2 already exist I, wish to assign a new variable to
them so I can use $1 and $2 in an existing_script.

The only script modification would be editing the variables at the top
which is better than re-working the entire script.

Matter of opinion... obviously my opinion is that it is *not*
good at all, much less "better"!

Good programming style would be to initially write the script
such that positional parameters are used once, to set another
variable to be used throughout the script.

Clearly that is not important for very short scripts, and it is
a judgement call on just when it does become of sufficient
significance to cause a rewrite of the script. It is way past
time to re-write the script if you perceive it as at all
difficult.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) floyd@xxxxxxxxxx
.



Relevant Pages

  • Re: Harriet Jones again
    ... >it being made up as RTD went along in the script. ... >introduction to a new series in my opinion - poor pilot, ...
    (rec.arts.drwho.moderated)
  • Re: Delphi Blogsphere
    ... > My real point is that if you don't allow JavaScript/ECMAScript, Flash, ... > you can only marginally claim to support HTML. ... > by posting a message with a syntax error in the script. ... It may be a well-informed opinion motivated by an uncanny grasp ...
    (borland.public.delphi.non-technical)
  • Re: on error resume next
    ... I know some consider this unsightly, but my opinion is that I'd ... The only time I can see where you want a production script to use On Error ... In short when using On Error command is there any easier or better ... My thoughts were to create a Constant OnError = True or False that is ...
    (microsoft.public.scripting.vbscript)
  • Re: Problem with a "simple" script
    ... Thanks for reaffirming my opinion that post, ... A prompt is a minor destraction as is an advert. ... The script is posted on http://home.comcast.net/~CaptQueeg/ShowHexEquivs.wsf. ... invoke my hex-editor to display the ASCII codes of the special ...
    (microsoft.public.scripting.wsh)
  • Re: The Starlost
    ... I am not sure how much Harlan's opinion is worth. ... I had heard for years how astoundingly wonderful his script for Asimov's ... I don't care how great he is, or thinks he is, the book _I, Robot_ was ... Robot has little to do with Susan Calvin's sex life. ...
    (rec.arts.sf.tv.babylon5.moderated)