[clue] bash/using variables in variable names

Christopher Cross g1ccross at gmail.com
Fri Jun 21 23:45:04 MDT 2013


I would think awk or cut is the better tool for CSV data.
On Jun 21, 2013 9:21 PM, "Mike Bean" <beandaemon at gmail.com> wrote:

> I'm trying to efficiently get data out of csv sheets and compare it
> against other variables.  Since it's arranged according to row, after I
> read Raymond's message,  I played around with sed'ing individual lines
> directly in an array.  Had more luck then I did with columns actually, so
> at the moment, it's the best bet.  Going to attack it again on monday.
>
>
> On Fri, Jun 21, 2013 at 4:47 PM, Quentin Hartman <qhartman at gmail.com>wrote:
>
>> Depending on what your purpose for the this script is be aware that
>> arrays are a fairly new GNU bash-ism, so if you use them your script may
>> not be portable to other *sh shells that only do POSIX compliance. One
>> relevant example is dash, which was (and I believe still is) the default
>> invoked by "sh" on Ubuntu machines.
>>
>> QH
>>
>>
>> On Fri, Jun 21, 2013 at 3:26 PM, Mike Bean <beandaemon at gmail.com> wrote:
>>
>>> Would export work in a script?   Huh...  Arrays make some intuitive
>>> sense.  Why is it these projects are never as simple as you think they're
>>> going to be when you start them?
>>>
>>> Mike Bean
>>>
>>>
>>> On Fri, Jun 21, 2013 at 3:09 PM, Raymond DeRoo <rderoo at deroo.net> wrote:
>>>
>>>> Mike:
>>>>
>>>> export is your friend.
>>>>
>>>> OK, I am just thoroughly writer's blocked, probably missing something
>>>> obvious; but who knows.  Anyway, here's my question
>>>>
>>>> # node=somenode
>>>> # echo $node
>>>> somenode
>>>> # somenodeVar=5  * // if this works*
>>>> # echo $somenodeVar
>>>> 5
>>>> # $node"Var"=5 *// why doesn't this work?*
>>>> bash: somenodeVar=5: command not found
>>>>
>>>>
>>>> [16:06:18 rderoo at daggoo ~]$ node=somenode
>>>> [16:07:03 rderoo at daggoo ~]$ echo $node
>>>> somenode
>>>> [16:07:49 rderoo at daggoo ~]$ export "${node}Var"=5
>>>> [16:07:57 rderoo at daggoo ~]$ echo $somenodeVar;
>>>> 5
>>>> [16:07:58 rderoo at daggoo ~]$ echo $somenodeVar;
>>>>
>>>>
>>>> For the time being well skip the discussion on why variable variables
>>>> are bad and that one should really be using arrays...
>>>>
>>>> Kind Regards,
>>>> Raymond
>>>>
>>>> _______________________________________________
>>>> clue mailing list: clue at cluedenver.org
>>>> For information, account preferences, or to unsubscribe see:
>>>> http://cluedenver.org/mailman/listinfo/clue
>>>>
>>>
>>>
>>> _______________________________________________
>>> clue mailing list: clue at cluedenver.org
>>> For information, account preferences, or to unsubscribe see:
>>> http://cluedenver.org/mailman/listinfo/clue
>>>
>>
>>
>> _______________________________________________
>> clue mailing list: clue at cluedenver.org
>> For information, account preferences, or to unsubscribe see:
>> http://cluedenver.org/mailman/listinfo/clue
>>
>
>
> _______________________________________________
> clue mailing list: clue at cluedenver.org
> For information, account preferences, or to unsubscribe see:
> http://cluedenver.org/mailman/listinfo/clue
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cluedenver.org/pipermail/clue/attachments/20130621/926c2b43/attachment.html 


More information about the clue mailing list