Execute Bash script stored in a file over SSH

前端 未结 5 1268
佛祖请我去吃肉
佛祖请我去吃肉 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:50

    cat foo.sh | ssh -T root@remote will to the trick. The -T option suppresses a warning you would otherwise get because you're piping input from a file.

提交回复
热议问题