【发布时间】:2014-04-02 04:33:39
【问题描述】:
有什么聪明的方法可以通过 ssh 在远程主机上运行本地 Bash 函数吗?
例如:
#!/bin/bash
#Definition of the function
f () { ls -l; }
#I want to use the function locally
f
#Execution of the function on the remote machine.
ssh user@host f
#Reuse of the same function on another machine.
ssh user@host2 f
是的,我知道这行不通,但是有没有办法做到这一点?
【问题讨论】: