When a shell runs an external executable as a command, we can pass environment variables into the executable.
$ var=3 /bin/echo `$var` $ var=3 bash -c "/bin/echo '$var'"
both don't output anything.
When a program is executed by
exec, I want to see if environment variable also works:
$ bash $ unset var; $ var=3 exec /bin/echo '$var' $var $ exec var=3 /bin/echo '$var' bash: exec: var=3: not found
To prevent variable expansion, I use single quote around
The protection seems a little too much.
Why is this environment variable not set up in the above cases?
Can I make environment variables work for a program executed by