bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RFE -or- Howto?


From: Linda Walsh
Subject: RFE -or- Howto?
Date: Mon, 26 Jul 2010 15:25:10 -0700
User-agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.8.1.24) Gecko/20100228 Lightning/0.9 Thunderbird/2.0.0.24 Mnenhy/0.7.6.666

 I don't know if there's an easy way, but if not would you consider an RFE --

Is there a syntax for a mult-var assignment, ala:
(a b c d)=(1 2 3 4)

results would be: a=1, b=2, c=3, d=4

I know I can get the rval into an array, but can't figure out how to move
the array vals to discrete variables.

In *this* particular situation, I'm trying to something like
for (p v1 v2) in "(a  1  2)" "(b  2.0 2.1)"  "(c  0.2.2  0.2.2-1)"; do
...

If it's not there, I wonder if it would be a syntactic advantage to use
a lead-in char, like "@" to indicate that a parenthesized list following
it would be a list of vars ?

I'm constantly running into little scriptlets that need multiple vals 
assigned/interation,
and it would be so handy to have a simple syntax, than to do the more perverse
thing:

U="$(uname -sno)"
PUB_CONST SYSTEM_KERNEL="${U%% *}"
U="${U##$SYSTEM_KERNEL }"
PUBLIC HOSTNAME="${U%% *}"
U="${U##$HOSTNAME }"
PUB_CONST OSTYPE="${U//\//-}"
unset U




reply via email to

[Prev in Thread] Current Thread [Next in Thread]