Dear Shell script Experts,
I am working on shell script which is defined here, qsub_seq.csh [1]. The purpose of this script is to read few input files (with defined starting index and last index) and make processing faster over server.
For some task, I had 1064 of input files, so I wrote another script, submitjob.sh [2] to make it quicker.
However, instantly I realized that it failed to work as the qsub_seq.csh script read the first digit of the input file and delete them all, though my input files have range from 0 till 1064, as given some examples of input files [3].
Any help, how to make qsub_seq.csh read two digits variable?
thank you in advance,
emily
[1] qsub_seq.csh
#!/bin/csh
# $1 - code name
# $2 - analysis macro
# $3 - base directory
# $4 - sample name
# $5 - starting index
# $6 - last index
rm -rf $4_files
mkdir $4_files
cp $2 $4_files/
cp qsub.sh $4_files/
cp temp $4_files/
cd $4_files
set n = $5
while ( $n <= $6 )
ls $3/$4/$4_${n}*.root > $4_$2_$n
./qsub.sh $1 $2 $4_$2_$n
@ n++
end
cd ../
[2] submitjobs.sh
#!/bin/sh
Start=0
Step=9
Entries=1164
while [ $Start -lt $Entries ]
do
if [ $Start -ge $Entries ]
then
break
fi
End=`expr $Start + $Step - 1`
./qsub_seq.csh AnalysisMacro analysisMacro.conf /nfs/dust/ DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8 $Start $End
echo 'job submitted for ' $Start, $End
Start=`expr $Start + $Step`
done
[3]
--------------
/nfs/dust/emily/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_0.root
/nfs/dust/emily/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_151.root
/nfs/dust/emily/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_299.root
/nfs/dust/emily/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_2.root
/nfs/dust/emily/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_99.root
/nfs/dust/emily/DYJetsToLL_M-50_TuneCUETP8M1_13TeV-amcatnloFXFX-pythia8_9.root