3

How can I run my local bash script remotely with SSH access?

Could I change the folder before run the script?

5

You can use this command to access your specific folder (e.g. html), then run your local bash script:

ssh user@remote_host 'cd html && bash ' < ../snippets/myCustomBash.sh
  • Checking cd for errors might possibly make more sense with && instead of the assuming it worked with the ; – thrig Apr 11 '17 at 20:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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