I am trying to imagine a (series) of assignments for SGE (FWIW, this is the sequence of modeling molecular dynamics of Gromacs) in which all assignments are identical except for the suffix such as input01 , input02 , etc. I wrote the commands to run in such a way that the suffix is correctly processed by the sequence of commands.
However, I cannot find a way to get the exec environment to get this variable. According to the qsub man page, -v var should do this.
$ export i=19 $ export | grep ' i=' declare -xi="19" $ env | grep '^i=' i=19
Then send the following script ( run.sh ) to find out if it is received:
if [ "x" == "x$i" ]; then echo "ERROR: \$i not set" else echo "SUCCESS: \$i is set" fi
I submit the job as follows (in the same session as the export command above):
$ qsub -N "test_env" -cwd -vi run.sh Your job 4606 ("test_env") has been submitted
The error stream is empty, and the output stream has:
$ cat test_env.o4606 ERROR: $i not set
I also unsuccessfully tried the following commands:
$ qsub -N "test_env" -cwd -vi -V run.sh $ qsub -N "test_env" -cwd -V run.sh $ qsub -N "test_env" -cwd -vi=19 -V run.sh $ qsub -N "test_env" -cwd -vi=19 run.sh
If I add the line i=19 to the beginning of run.sh , the output will be as follows:
$ cat test_env.o4613 SUCCESS: $i is set as 19
Now I am considering the possibility of creating one file per task, which will be essentially the same, but will have the line i=xx as the first. It does not look very practical, but it will be a solution.
Would there be a better solution?