parameter for shell scripts that is started with qsub

后端 未结 4 698
梦谈多话
梦谈多话 2020-12-12 22:21

how can I parametrize a shell script that is executed on a grid (started with qsub) ? I have a shell script, where I use getopts to read the parameters.

When I star

4条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-12 22:29

    In addition to volk's answer, in order to reference the variables in the list (designated by -v) you simply use the name you define in your call. So, say you made a call to qsub as follows

    qsub -v foo='qux' myRunScript.sh

    Then myRunScript.sh could look something like this:

    #!/bin/bash
    #PBS -l nodes=1:ppn=16,walltime=0:00:59
    #PBS -l mem=62000mb
    #PBS -m abe
    
    bar=${foo}
    echo "${bar}"
    

    Where the output would be

    qux
    

    Hope this helps!

提交回复
热议问题