Re: Can $1 be set in a script?
- From: floyd@xxxxxxxxxx (Floyd L. Davidson)
- Date: Thu, 30 Mar 2006 14:57:32 -0900
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
.
- References:
- Can $1 be set in a script?
- From: larryalk
- Re: Can $1 be set in a script?
- From: Chris F.A. Johnson
- Re: Can $1 be set in a script?
- From: larryalk
- Re: Can $1 be set in a script?
- From: Floyd L. Davidson
- Re: Can $1 be set in a script?
- From: larryalk
- Can $1 be set in a script?
- Prev by Date: Re: Can $1 be set in a script?
- Next by Date: Re: Can $1 be set in a script?
- Previous by thread: Re: Can $1 be set in a script?
- Next by thread: Re: Can $1 be set in a script?
- Index(es):
Relevant Pages
|