Reducing what I'm trying to do to a simple example:
env temp=`pwd` echo "$temp"
I get this message:
temp: Undefined variable.
How do I make it work (in a shell-agnostic way)? I'm expecting the result of pwd
to be printed.
My actual requirement uses a complicated expression in place of pwd
, a script in place of "echo
", and the variable $temp
as an argument to that script.
Also, I want to set this variable only for this single command, and not for the whole shell (or any subsequent subshells).