On Thu, Aug 02, 2007 at 07:18:54AM +0200, Ola Lundqvist wrote: > On Wed, Aug 01, 2007 at 11:49:19PM +0200, Marc Haber wrote: > > I am afraid that your way of parsing the environment won't work. One > > of the difficulties is that one cannot easily distinguish between > > "unset variable" and "variable set with a null value", which would be > > needed to find out whether a variable is not meant to be overridden > > (unset), or meant to be overridden with a null value (empty). > > I do not agree. Look at this: > > [EMAIL PROTECTED]:~/minirc$ set | grep "^XX" > [EMAIL PROTECTED]:~/minirc$ XX=1 > [EMAIL PROTECTED]:~/minirc$ set | grep "^XX" > XX=1 > [EMAIL PROTECTED]:~/minirc$ XX= > [EMAIL PROTECTED]:~/minirc$ set | grep "^XX" > XX= > [EMAIL PROTECTED]:~/minirc$ unset XX > [EMAIL PROTECTED]:~/minirc$ set | grep "^XX"
That'll work, but is mucho ugly. I think that my way is much more elegant. > > I am therefore afraid that we won't get along without an explicit list > > of Variables needed for the override mechanism (since we need to know > > which variables to copy into the _THIS variables). In a first step, > > $ACTIONF is sourced to initiate the global overrides of the plain > > variables. We then copy the contents of FOO to FOO_THIS (which is the > > variable that will actually be used by this iteration's code) and > > source $ACTIONF again. This time, the FOO_THIS definitions inside > > $ACTIONF get in effect. > > Well copy things from the normal variable to a this variable is > an other way. Then we do not need to restore... Yes, and with the double source, we get both the temporaray and the permanent overrides. > > It was a long day for me, so I might be wrong, but you'll point me > > into the right direction. > > I hope you have had a good night sleep by now. :) Not quite. Looks like I'm sick today - my temperature is raised, my tonsils are swollen, I had a bad shiver last night when going to bed, and I need to go to Berlin today for a business trip. > I can accept your patch below, if you can convince that the way > I get the list of variables do not work. I'm not right now. :) Assuming that we stay with the "use _THIS variables in the code" approach, how would you get the list of unsuffixed variables? Would you rather copy the entire environment to _THIS variabls? Or how do you want to select which variables to copy and which not? Greetings Marc -- ----------------------------------------------------------------------------- Marc Haber | "I don't trust Computers. They | Mailadresse im Header Mannheim, Germany | lose things." Winona Ryder | Fon: *49 621 72739834 Nordisch by Nature | How to make an American Quilt | Fax: *49 3221 2323190 -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]