bug-bash
[Top][All Lists]
Advanced

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

Re: How to do? Possible?


From: Steven W. Orr
Subject: Re: How to do? Possible?
Date: Mon, 25 Jul 2011 11:06:46 -0400
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20110624 Thunderbird/5.0

On 7/25/2011 5:20 AM, Linda Walsh wrote:



I got great help in learning about how to do the  perl equiv of (var1,
var2, var3)= (list) using read var1 var2 var3<<<(list).

I use it often to get back lists of values from subroutine calls, but with
sometimes useful, and sometimes hindering fact that when I do
read var1 var2 var3<<<$(function x y z)

function's ability to affect the global env, is 'nixed',

is there something like a
read var1 var2 var3<<<${function x y z), that would do the same, but
like {} in code, wouldn't put the contents in a sub proc?


I can think of uglier looking ways to get around it, but was hoping
for something more elegant.

Truth be told, I split a file that was growing too large that had a mix
of functions and calls to them, by putting the functions into a separate
lib but I'd like the lib to be a bit more general and keep it's own state
(shared with the parent or not, wouldn't matter in my design), but as the
function calls are called in the (), there seems to be no easy way to
export them to anything that will be shared



I highly recommend reading this, but read it *very carefully*. I have adopted this in my production system and it works great. The idea is to implement passing variables by reference and to allow the values to be either scalars or arrays. It sounds like you would benefit from this.

http://fvue.nl/wiki/Bash:_Passing_variables_by_reference

--
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net



reply via email to

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