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)"

closed as unclear what you're asking by G-Man, Ipor Sircer, RalfFriedl, msp9011, Mr Shunz Jan 23 at 9:09

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Please comment here or on my answer if it doesn't solve your problem. – Crypteya Jan 23 at 1:39

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"
  • Thanks so much!!! Finally, I am trying to solve this for 3 hours :D – Caslav Sabani Jan 23 at 2:41

Same as locally;

ssh $SERVER install.sh argument

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