Skip to content
Prev 56509 / 63424 Next

Possibly broken system2 env-option

You are using it wrong. It wants strings of the form "name=value", not a character vector with names as labels. So this is closer to the mark:
However, as you see it doesn't work as intended. The problem is that the $-substitution refers to the environment of the shell executing the command. I.e. this does not work from a terminal command line either:

pd$ VAR="foo" echo $VAR

pd$

Or even

pd$ VAR="bar"
pd$ VAR="foo" echo $VAR
bar

What you need is something like (NB: single quotes!)

pd$ VAR="foo" sh -c 'echo $VAR'
foo

So:
Hello World

-pd