Skip to content

Help needed related to bash loop

Hi, I'm trying such construction in CI/CD script

for CASE in $NEW_CASES ; do export CASE_DIR=$(dirname $CASE) ; cd CASE_DIR && python3 -m snakemake --cores $SNAKEMAKE_CORES && python3 -m snakemake --report report.html ; done 

It leads to error:

333 /var/spool/slurmd/job2254278/slurm_script: line 115: cd: CASE_DIR: No such file or directory

Is there any problem with dirname? Couldn't be suggested another tool to extract directory name from filepath?