Is there a way to pass an environment variable to two processes that are started in one line in bash? I want to execute two processes in the same command line
# these are ways to execute two processes in the same line
exec1 & exec2
exec1 && exec2
exec1 || exec2
exec1; exec2
And this is the way to pass an environment variable to a process:
VAR=value exec
How can I combine both?
# this is not enough because exec2 does not see VAR
VAR=value exec1 & exec2
I know the way to do it with export:
export VAR=value; exec1 & exec2; unset EXPORT
Is there another way to do it without export?
VARhad a value before, it no longer does after.