Hi,

Am 03.03.2014 um 16:05 schrieb Pablo Escobar:

> Hi guys
> 
> I am running this submit script which works fine and generates a new file 
> "myout.txt" which contains the string "test"
> 
> #!/bin/bash
> #$ -N test
> #$ -l h_vmem=1G
> #$ -cwd
> echo "test" > myout.txt
> 
> 
> But when I try to do the same in an array job it's not working :?
> 
> This is my submit script:
> 
> #!/bin/bash
> #$ -N testArray
> #$ -l h_vmem=1G
> #$ -cwd
> #$ -t 1-1
> SEEDFILE=$PWD/cmd.txt
> SEED=$(cat $SEEDFILE | head -n $SGE_TASK_ID | tail -n 1)

SEED=$(sed -n ${SGE_TASK_ID}p $SEEDFILE)

might be shorter.

> $SEED
> 
> 
> This is my cmd.txt:
> 
> $ cat cmd.txt 
> echo "test" > myoutput.txt
> 
> But when submitting this intead of getting a new file "myoutput.txt" I get 
> the normal grid engine STDOUT file wich contains everything right after the 
> "echo" command:
> 
> $ cat testArray.o1769682.1 
> "test" > myoutput.txt
> 
> I have tried to redirect stdout and stderr with &>, also tried "qsub -o 
> /dev/null -j y" and a few other variantes without luck

This happens, as bash is not re-interpreting the content of the string again 
(it knows about the ">" only after it expanded $SEED already). What will do it:

eval $SEED

NB: http://mywiki.wooledge.org/BashFAQ/048

-- Reuti


> any clue about how I can manage to get standar stdout redirections working in 
> an array job? I know I could use -o and -e but my users WANT to do it like 
> this....  
> 
> thanks in advance for any help.
> Pablo.
> _______________________________________________
> users mailing list
> [email protected]
> https://gridengine.org/mailman/listinfo/users


_______________________________________________
users mailing list
[email protected]
https://gridengine.org/mailman/listinfo/users

Reply via email to