2015-12-13 51 views
1

我的问题是: 我有我的库(我们称之为qa-baslib.sh)与各种实用功能,我包括它的测试脚本,我们是发展。有没有办法在其他源脚本中输入bash脚本

现在,其他开发人员创建了bash脚本库来支持到各种服务器的SSH连接(我们称之为global_ssh)。它看起来是这样的:

global_ssh

#!/bin/bash 

global_ssh(){ 

    # Doing some ssh stuff 
} 

我认为采购文件global-ssh这样的:

qa-baslib.sh

#!/bin/bash 

. /<path-to>/qa-util-scripts/global_ssh 

function some_util_function() { 
    server=$1 
    command=$2 

    # Here i'm calling global_ssh function 
    timeout -s 9 30 global_ssh $sever $command 
} 

但是当我最终执行的功能,通过采购它从命令行,我得到错误:

]# . /<path-to>/qa-bashlib.sh 
]# some_util_function $server $command 
]# timeout: failed to run command `global_ssh': No such file or directory 

有什么不对,有没有解决方法?

由于

+0

是在脚本#1一个错字或事业的家当? – frlan

+0

@frlan对不起,修正:) – Samuel

+1

你确定你的系统的'timeout'可以运行一个shell函数吗? (什么'类型超时'打印?)**编辑添加:**请参阅http://stackoverflow.com/questions/9954794/execute-function-with-timeout。 – ruakh

回答