Execute Bash script stored in a file over SSH

前端 未结 5 1245
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 05:08

Say I have the following Bash script stored in the file foo.sh:

#!/bin/bash
echo foo

Without having to scp the fi

5条回答
  •  被撕碎了的回忆
    2020-12-29 05:44

    ssh root@MachineB 'bash -s' < local_script.sh
    

    I got it from that thread: How to use SSH to run a shell script on a remote machine?

提交回复
热议问题