I found this bash
script on GitHub that I want to use for my own work. My question is the following: What do the lines 2 to 5 mean? Are they just comments or do they serve any purpose?
#!/bin/bash
#$ -l h_rt=72:00:00
#$ -V
#$ -N index_calc
#$ -j y
source ~/modules.sh
cd $1
l_file=`find . -name 'L*stack' -type f`
for l in $l_file; do
echo "Running on file:"
echo $l
extract=${l:0:45}
name=${extract}_index.tif
echo "Name of index stack:"
echo $name
echo "Executing code..."
~/Documents/misc/spectral/transforms.py \
-v $l $name evi ndvi nbr ndmi
done
echo "Done!"
Best Answer
The lines beginning with
#$
are options forqsub
, a command used to submit a job to the SGE cluster, a scheduling system explained in this readme:The syntax of the
qsub
command is explained on its manpage, your script uses the following options:-l h_rt=<hh:mm:ss>
– specify the maximum run time (hours, minutes and seconds)-V
– pass all environment variables to the job-N <jobname>
– specify the name of the job. This you will see when you useqstat
, to check status of your jobs.-j y[es]|n[o]
– specifies whether or not the standard error stream of the job is merged into the standard output streamAs How to submit a job using qsub explains one can set the
qsub
options directly in the script in lines that begin with#$
. This an alternative to passing them with theqsub
command on the command-line.