-1

How can I pass arguments to install.sh script when calling it after ssh. This is how I call it:

declare -r SCRIPT_PATH=${BASH_SOURCE%/*}/install.sh;
ssh -tt ${!SERVER_ADDRESS} "$(cat $SCRIPT_PATH)"
  • Please comment here or on my answer if it doesn't solve your problem. – Crypteya Jan 23 at 1:39
2

Since you're sending the contents of the script, I'd suggest you inject the arguments into it by using the set command to set the positional parameters:

ssh -tt "${!SERVER_ADDRESS}" <<END
set -- "arg 1" "arg 2" "arg 3"
$(cat $SCRIPT_PATH)
END
  • Thanks so much!!! Finally, I am trying to solve this for 3 hours :D – Caslav Sabani Jan 23 at 2:41
0

Same as locally;

ssh $SERVER install.sh argument

Not the answer you're looking for? Browse other questions tagged or ask your own question.