Question

I have a script which begins by defining a series of variables, before running a programme with those variables. However, the script is being rejected from Grid Engine (it works on a workstation, but as one component of an array job, it needs to run via SGE) because the variables are being read as commands, resulting in a "Command not found" response.

The error is completely reproduced using the following:

#!/bin/bash
#$ -M not.real@email.address
#$ -m be
#$ -o /scratch/MScGWAS/Output
#$ -e /scratch/MScGWAS/Errors
#$ -q long.q
#$ -cwd
CHR=$1
CHUNK_START=`printf "%.0f" $2`
CHUNK_END=`printf "%.0f" $3`

Output Example:

CHR=1: Command not found.
CHUNK_START=1: Command not found.
CHUNK_END=5000000: Command not found.

How can I get GridEngine to use bash as the interpreter for this script?

Was it helpful?

Solution 2

It sounds like your grid engine cluster is configured with the queues in posix_compliant mode and /bin/csh as the default shell. In posix_compliant mode the initial #! is ignored and you need to specify the shell via a command line switch or with a suitable #$ directive. Adding the following line to your script should work:

#$ -S /bin/bash

OTHER TIPS

You are not executing your script with bash, but with a different shell (e.g. tcsh).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top