【发布时间】:2016-04-02 01:01:09
【问题描述】:
我想运行一个脚本 test.sh,它位于 A 本身的机器 A 上,但来自机器 B。在 Unix 中有什么方法可以做到这一点
【问题讨论】:
标签: linux shell unix sh remote-server
我想运行一个脚本 test.sh,它位于 A 本身的机器 A 上,但来自机器 B。在 Unix 中有什么方法可以做到这一点
【问题讨论】:
标签: linux shell unix sh remote-server
您可以使用ssh 来实现:
ssh -t user@host '/path/to/test.sh'
根据man ssh,这就是-t 选项的作用:
强制伪 tty 分配。这可用于在远程机器上执行任意基于屏幕的程序,这很有用, 例如实现菜单服务时。多个 -t 强制 tty 分配,即使 ssh 没有本地 tty。
【讨论】: