I have written a script that is shown below. However, when I run the script it just outputs the final command instead of running it. What do I need to add at the end so that the command will be run?
Thank you
#!/bin/bash -l
#$ -cwd
# file name: singlecell.sh
rundir=$1
outdir=$2
samplesheet=$3
USAGE="Usage: $0 -i [path to input run directory] -o [path to output directory] -s [path to sample sheet]"
while getopts i:o:s:h opt
do
case "$opt" in
i) RunDir="$OPTARG";;
o) OutDir="$OPTARG";;
s) SampSheet="$OPTARG";;
h) echo $USAGE; exit 1
esac
done
if [[ $RunDir == "" || $OutDir == "" || $SampSheet == "" ]]
then
echo $USAGE
exit 1
fi
# asssume only one index type per run
index8=`grep "SI-GA\|SI-NA" $SampSheet | wc -l`
ignore=""
# check if single indexes.
if [ $index8 -gt 0 ]; then
ignore="--filter-single-index"
else
ignore="--filter-dual-index"
fi
cmd="cellranger mkfastq --run=$RunDir --output-dir=$OutDir --csv=$SampSheet --localcores=8 --localmem=40 $ignore --barcode-mismatches=0"
echo $cmd
$cmd