passando a variável através do comando cat EOF com loop for

1

Como faço para que o script seja executado com o comando sbatch para ser executado com o 23 run_prep_chem_ $ dd.sh (ou seja, run_prep_chem_08.sh ... run_prep_chem_30.sh)? Eu estou pensando desde o seu loop for que seria executado corretamente. O código acima do sbatch faz um loop de 23 vezes, mas não da linha de script sbatch

#!/bin/bash

RP_INPUT='$RP_INPUT'
END='$END'

for dd in {08..30}; do

set dd=$dd

printf  "%-3s %02d\n" "$dd" "$((10#$dd + 1))"

cat > /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/PREP_FILES/prep_chem_sources_$dd.inp << __EOF
$RP_INPUT

!---------------- grid_type of the grid output
   grid_type= 'mercator',
                        !'rams' = rams grid
                        ! 'polar'  = polar sterog. grid output
                        ! 'gg'  = gaussian grid output
                        ! 'll'  = lat/lon grid output
                        ! 'lambert'  = lambert grid output
                        ! 'mercator' = mercator grid output

!---------------- if the output data is for use in CATT-BRAMS model, provide at least one analysis file

$END

__EOF

cp /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/PREP_FILES/prep_chem_sources_$dd.inp /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/prep_chem_sources.inp

cat > /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/PREP_FILES/run_prep_chem_$dd.sh << BEOF
#!/bin/bash -x
#SBATCH --ntasks=1
#SBATCH --mem-per-cpu=100000
#SBATCH --cpus-per-task=1
#SBATCH --time=00:30:00
export I_MPI_JOB_STARTUP_TIMEOUT=10000

source /etc/bashrc

module load hdf5/1.8.12

srun --distribution=block:block /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/prep_chem_sources_RADM_WRF_FIM.exe

BEOF

chmod 757 /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/PREP_FILES/run_prep_chem_$dd.sh

mv /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/PREP_FILES/run_prep_chem_$dd.sh  /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/run_prep_chem_$dd.sh

sbatch --dependency=afterok:$SLURM_JOB_ID /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/run_prep_chem_$dd.sh

cp /data/users/jwsmith/PREP-CHEM-SRC-1.4/bin/AEROSE_APRIL_CTL-T-2010-04-$dd-000000-g1-ab.bin /data/users/jwsmith/WRFV3/run/AEROSE_APRIL_CTL-T-2010-04-$dd-000000-g1-ab.bin

done
    
por Jonathan Smith - NOAA Affiliat 03.11.2014 / 00:12

0 respostas