Skip to main content
added 162 characters in body
Source Link
Gilles 'SO- stop being evil'
  • 866.1k
  • 205
  • 1.8k
  • 2.3k

I don't know an easy way of exporting environmental variables to target, but your script might work if you replace '' with "". With 's's the string 'cd ${LOCATION}; ./${EXEC}''cd ${LOCATION}; ./${EXEC}' gets passed verbatim, but with

ssh username@target "cd ${LOCATION}; ./${EXEC}"

variable substitution is done locally.

Note that the values of LOCATION and EXEC are passed to the remote shell, so this only works if they don't contain any shell special characters.

I don't know an easy way of exporting environmental variables to target, but your script might work if you replace ' with ". With 's the string 'cd ${LOCATION}; ./${EXEC}' gets passed verbatim, but with

ssh username@target "cd ${LOCATION}; ./${EXEC}"

variable substitution is done locally.

I don't know an easy way of exporting environmental variables to target, but your script might work if you replace ' with ". With 's the string 'cd ${LOCATION}; ./${EXEC}' gets passed verbatim, but with

ssh username@target "cd ${LOCATION}; ./${EXEC}"

variable substitution is done locally.

Note that the values of LOCATION and EXEC are passed to the remote shell, so this only works if they don't contain any shell special characters.

Source Link
isido
  • 151
  • 1
  • 3

I don't know an easy way of exporting environmental variables to target, but your script might work if you replace ' with ". With 's the string 'cd ${LOCATION}; ./${EXEC}' gets passed verbatim, but with

ssh username@target "cd ${LOCATION}; ./${EXEC}"

variable substitution is done locally.