Hi Marc

On Wed, Aug 01, 2007 at 12:05:29PM +0200, Marc Haber wrote:
> On Wed, Aug 01, 2007 at 11:51:36AM +0200, Ola Lundqvist wrote:
> > The drawback is that we will have a separate proces for each action, but
> > maybe that is ok?
> 
> As long as the actions don't try communicating back to the caller,
> this could be fine. Communicating unfortunately includes "abort".

True! We need to be able to do the abort in a good way.

> > > Yes, that would be my intention. Want me to deliver a patch?
> > 
> > Yes that would be nice.
> > 
> > Either some _HERE thing or scope handling as described above.
> 
> I like the _HERE thing better, especially because the scope thing
> would not preserve backwards compatibility.

I tend to agree.

I created something that you can use when creating the patch. I think
it is general enough.

# Set variable to here value
SIFS=$IFS
IFS="
"

LIST=$(set | grep "^[a-zA-Z][a-zA-Z0-9_]*_HERE" | sed -e "s|=.*||;")
for HVAR in $LIST ; do
    # Var name
    VVAR=$(echo $HVAR | sed -e "s|_HERE$||g;")
    # Stored var name
    eval "SVAR=${VVAR}_STORED"
    # Store the value to stored variable
    eval "$SVAR=\$$VAR"
    # Set variable to here variable
    eval "$VVAR=\$$HVAR"
done

.......

# Restore the value

# Restore
echo "# Restore"
for HVAR in $LIST ; do
    # Var name
    VVAR=$(echo $HVAR | sed -e "s|_HERE$||g;")
    # Remove the here variable so it is not set next time
    eval "unset $HVAR"
    # Stored var name
    eval "SVAR=${VVAR}_STORED"
    # Restore the value
    eval "$VVAR=\$$SVAR"
done
IFS=$SIFS

Best regards,

// Ola

> 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
> 

-- 
 --- Ola Lundqvist systemkonsult --- M Sc in IT Engineering ----
/  [EMAIL PROTECTED]                   Annebergsslingan 37        \
|  [EMAIL PROTECTED]                   654 65 KARLSTAD            |
|  http://opalsys.net/               Mobile: +46 (0)70-332 1551 |
\  gpg/f.p.: 7090 A92B 18FE 7994 0C36 4FE4 18A1 B1CF 0FE5 3DD9  /
 ---------------------------------------------------------------


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to