I want to be able to run a command from my machine using ssh and pass through the environment variable $BUILD_NUMBER
Here\'s what I\'m trying:
As answered previously, you do not need to set the environment variable on the remote host. Instead, you can simply do the meta-expansion on the local host, and pass the value to the remote host.
ssh pvt@192.168.1.133 '~/tools/run_pvt.pl $BUILD_NUMBER'
If you really want to set the environment variable on the remote host and use it, you can use the env program
ssh pvt@192.168.1.133 "env BUILD_NUMBER=$BUILD_NUMBER ~/tools/run_pvt.pl \$BUILD_NUMBER"
In this case this is a bit of an overkill, and note
env BUILD_NUMBER=$BUILD_NUMBER does the meta expansion on the local
hostBUILD_NUMBER environment variable will be used by