Reputation: 11
I'm having trouble to fill in a variable when connecting to a remote machine through ssh.
I'm trying to execute the following statement in a bash script:
ssh user@host '$INSTALL_DIR/script/replaceAll.sh'" $orig_val $new_val";
$INSTALL_DIR is a global variable on both machines with a different value on each, while $orig_val and $new_val are variables calculated in the script itself. I'm using SunOS 5.10
The problem is that $INSTALL_DIR uses the local value, while it should be using the remote value. Can you tell me what i'm doing wrong here?
Upvotes: 1
Views: 899
Reputation: 360375
Escape the dollar sign:
ssh user@host '\$INSTALL_DIR/script/replaceAll.sh'" $orig_val $new_val"
Upvotes: 2
Reputation: 1
your shell's evaluating the variable before passing it to ssh, you need to force the shell to treat the arguments as pure text
Upvotes: 0