This command works as expected
> TEST=`uuidgen` sh -c 'echo "$TEST"' BE6DFB7B-D872-49D7-91E6-24D01644B0A2 > echo $TEST [empty line]
It sets the
TEST variable locally on the command line and it is echoed by the echo command. After this line is executed,
TEST is no longer set.
> TEST=`uuidgen` sh -c 'echo "$TEST"' && sh -c 'echo "$TEST"' 52EFFEAA-D094-4FC3-8212-6A294918E265 [empty line]
TEST variable set for the first command, but not the command after the
I want it to be set for both commands. What is the best way to achieve this?