[luv-main] source the output of a file

I have a command that has output like: VAR1=A VAR2=B VAR3=C I want to execute that command in a shell script such that those statements are execute into my environment, so $VAR1 is now equal to 'A'. I can just put the output in a temporary file and then source that file, but is there a more direct way? Thanks James

On 17/09/2011, at 16:27, "James Harper" <james.harper@bendigoit.com.au> wrote:
I have a command that has output like:
VAR1=A VAR2=B VAR3=C
I want to execute that command in a shell script such that those statements are execute into my environment, so $VAR1 is now equal to 'A'.
I can just put the output in a temporary file and then source that file, but is there a more direct way?
eval $(thecommand)

On 17/09/2011, at 16:27, "James Harper" <james.harper@bendigoit.com.au> wrote:
I have a command that has output like:
VAR1=A VAR2=B VAR3=C
I want to execute that command in a shell script such that those statements are execute into my environment, so $VAR1 is now equal to 'A'.
I can just put the output in a temporary file and then source that file, but is there a more direct way?
eval $(thecommand)
That's it. Thanks! James
participants (2)
-
hannah commodore
-
James Harper