11

I would like to pass variables to a csh script by using "qsub -v" command. I understand we can list the parameters-value pairs as below,

qsub -v par1=value1 par2=value2 myScript.csh

Does anyone know if the values of these parameters can be a string, a list of numerical numbers separated by comma sign or a filename ? for example, is the command below possible ?

qsub -v par1='Cassie_score' par2=cassieFile.txt par3='100,200,300,' myScript.csh

Thank you very much,

1 Answer 1

13

They just need to be comma-separated:

qsub -v var1="val1",var2=1,var3=val3 script.csh

For your example that'd be:

qsub -v par1='Cassie_score',par2=cassieFile.txt,par3='100,200,300,' myScript.csh

Just note that this wouldn't move cassieFile.txt to the node that will run the job, so cassieFile.txt would need to be a path to a location on a shared filesystem.

4
  • 2
    If I'm not mistaken, @dbeer is the person who (basically) wrote the code that parses this option in torque >= version 4. Commented Oct 19, 2012 at 2:15
  • WOW~ Cool~ Thanks a lot. It worked fine with one little problem. When I set par3 as '100,200,300,', myScript.csh can only get the first value 100. I guess it assume that's the separator. Is there any way to make sure the variable par3 get the rest of string ? (The string will be used as input setting for some model running remotely so the comma separators among these 3 values can not be changed. I have no control about the format of the string.) Thank you very much,
    – Cassie
    Commented Oct 24, 2012 at 21:43
  • I eventually used space delimiter to separate the numbers in the string and add the comma back on.
    – Cassie
    Commented Oct 30, 2012 at 16:51
  • @Cassie: If you don't specify a value, the value will be copied from the environment. You can use this to get a comma-separated value through: setenv par3 100,200,300; qsub -v par1='Cassie_score',par2=cassieFile.txt,par3 myScript.csh.
    – amaurea
    Commented Mar 21, 2016 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.