Reputation: 32697
I am writing a script in bash which needs to do things like:
ssh -q 192.168.0.123 echo $FOO $BAR
My questions are in fact two:
How do I pass a local variable from the machine that is invoking it ($FOO
)?
How do I specify a remote variable ($BAR
)?
Upvotes: 2
Views: 1072
Reputation: 3801
use "$localvar" around local variables and '$remotevar' around remote ones, so that your local shell interpret ("$localvar") or does not interpret ('$remotevar') the variable accordingly.
so
ssh -q 127.0.0.123 echo "$FOO" '$BAR'
(you do know that 127.0.0.0/8 is your local machine, heh? ^^)
Upvotes: 2