Hi all, sorry if this is a repeated question but
I was trying to figure out env, ( i.e. calling a util with a new environment).
Just as an example my environment variable KDEDIRS = /usr in my current environment and lets say I type:
env -i KDEDIRS=/home/newkdedir env
This outputs KDEDIRS=/home/newkdedir as expected. (i.e calling second env with the new environment)
Now i wanna call say utility echo same way
env -i KDEDIRS=/home/new_kdedir echo ${KDEDIRS}
This is obviously not gonna work bec. shell expands KDEDIRS before it gets to echo. So the output is /usr (i.e. value in the current environment)
Then i try indirection and type in
env -i KDEDIRS=/home/newkdedir echo ${!KDEDIRS}
This outputs nothing.
I might be a little bit confused about this but how can i make the shell expand that KDEDIRS variable according to the newly created environment for echo?
Thank ya all!