Let's pretend that in the current shell, I have a variable.
$ echo $MY_VAR
$ 2
What I want is to pass the value of this variable to an argument of a command I'm executing through ssh, like:
ssh -i /ebs/keys/test [email protected] '/some/command -<here_i_want_to_have_value_of_$MY_VAR_variable>'
Thanks!
This can be found by pressing the windows key and typing command prompt and hitting enter. The ssh syntax is ssh username@destation and then hitting enter and supplying your password. In this case your username will be your hawkID and your password.
Assuming you cannot use double quotes around the entire command to ssh, you could break just $MY_VAR out like this:
ssh -i /ebs/keys/test [email protected] '/some/command -'"$MY_VAR"
If the rest of the command to ssh does not contain tokens that will be interpreted within double quotes, you can enclose the entire command in double quotes instead of single.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With