在bash脚本中使用bsub lsf调用bash函数

在bash脚本中使用bsub lsf调用bash函数,bash,lsf,Bash,Lsf,我有一个bash函数,我想订阅。当我试图获取脚本的源代码时,它被递归调用,但是如果我没有获取脚本的源代码,它似乎无法识别我的函数。如何正确调用同一脚本文件中的函数besub 我的脚本(应打印“12345”): a.bash可能是这样的 #! /bin/bash export input=$1 function myFunct { echo "$input" } # This is if you want to call bsub outside the bash # Use bsub -q

我有一个bash函数,我想订阅。当我试图获取脚本的源代码时,它被递归调用,但是如果我没有获取脚本的源代码,它似乎无法识别我的函数。如何正确调用同一脚本文件中的函数besub

我的脚本(应打印“12345”):


a.bash
可能是这样的

#! /bin/bash

export input=$1
function myFunct {
echo "$input"
}

# This is if you want to call bsub outside the bash
#  Use bsub -q Queue `./a.bash 12345`

myFunct "$input"  


# Put bsub inside and call the script
# ./a.bash 12345

bsub -q myQueue `myFunct "$input"`  

我已经让它工作了

bsub [...] bash -rcfile my_script.sh -i -c "myFunct 12345"

谢谢。如果我想在一个.bash内给bsub打电话,会怎么样?我之所以要这样做,是因为我的实际代码中有一个forloop。您可以编写
bsub-q队列`myFunct'$input`
,而不是
myFunct“$input”。然后再次执行
/a.bash 12345
.thx..但它似乎无法找到myFunct。我通过将echo“$input”替换为“mkdir myDir”来测试它,但没有创建任何内容。有什么想法吗?请注意,
$input
是您必须为脚本提供的参数。还要检查脚本的权限。粘贴执行脚本时显示的错误。让我们
bsub [...] bash -rcfile my_script.sh -i -c "myFunct 12345"