Search code examples
bashcshqsubshebangsungridengine

qsub is executing my bash script in csh despite shebang


I want to submit a bash script to my university's Sungrid computing cluster to run an executable in a loop. When I log in to the server, I'm in bash:

$ echo $SHELL
/bin/bash

And I include a bash shebang at the top of the script that I pass to qsub:

$ cat shell_sub
#!/bin/bash
#$ -N bSS_s13
#$ -o logs/bSS_s13.log
#$ -j y
#$ -cwd

echo $SHELL > shell.txt

But when I submit the above script:

qsub shell_sub

It instead executes in csh:

$ cat shell.txt
/bin/csh

How can I force qsub to execute my script with bash instead of csh?


Solution

  • You can set the shell for a submitted job (at least in Torque) using -S.

    For example: qsub shell_sub -S /bin/bash