Domanda

I have a bash function i would like to bsub. It is recursively called when i try to source the script, but if i don't source the script it doesn't seem to recognize my function. How do I correctly call besub on a function within the same script file?

my_script(should print "12345"):

#! /bin/sh
function myFunct {
echo $1
}

bsub -q myQueue "source ./my_script; myFunct 12345"
È stato utile?

Soluzione

a.bash may look like this

#! /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"`  

Altri suggerimenti

I've gotten it to work with

bsub [...] bash -rcfile my_script.sh -i -c "myFunct 12345"
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top