0
votes

How do I pass arrays as a variable list via qsub job script in PBS environment?

For example:

arr1=(1 2 3); arr2(a b c); qsub -v array1=("${arr1[@]}"), array2=("$arr2[@]") job_script.bash

where job_script.bash has array variables array1 and array2.

When I try to run the above command to submit my job I get following error:

-bash: syntax error near unexpected token `('

Am I missing something in my syntax?

I looked any many forums for help but not finding anything regarding passing arrays as above.

Can anyone help me with above situation?

2
Explain qsub and PBS. - ceving
qsub is the command to submit job in clusters with grid computing environment: docs.adaptivecomputing.com/torque/4-1-4/Content/topics/commands/… PBS is the grid computing software that provides the platform for the jobs to be submitted to computing clusters and executed: pbsworks.com/Product.aspx?id=26 - Rahil Sethi
Here is Wikipedia link to explain PBS in layman terms: en.wikipedia.org/wiki/Portable_Batch_System - Rahil Sethi
Look closely: what is wrong with array2=("$arr2[@]") -- something is missing... - David C. Rankin

2 Answers

0
votes

The problem does not appear to be with qsub, rather you did not create your arr2 variable correctly in the shell...

#  You did this...
arr1=(1 2 3); arr2(a b c); 

#  You meant this...
arr1=(1 2 3); arr2=(a b c); 
-1
votes

I use qsub on a daily basis. maybe a dumb answer, but could the problem be due to the space you leave between your two array variables in the -v argument?

i.e. your qsub command should be "qsub -v array1=("${arr1[@]}"),array2=("$arr2[@]") job_script.bash"