jeudi 18 juillet 2019

The continue in if loop is not going to next lines of the script

I have a bash script with an if condition and continuous lines of script. However, after if loop nothing in the script seems to run. For example, here are the lines of script (The lines after continue in if loop are not reacting).

 dir=/usr/path/tofiles
    for file in $(find $dir -name \*txt)
    do
        fbase={file%.txt}
        if [ "$step" == "1" -a ! -f "${fbase}.header" ]
            then
                continue
        fi

    ### From here nothing in the script runs #####

        if [ -f "${fbase}merged" ]
        then
                echo "$file already merged"
        fi

       files="$files ${fbase}g.txt.gz"
       cnt=$(($cnt + 1))
       if [ "$cnt" -eq "$chunksize" ]
       then
           outid=$(uuidgen)
           logfile=${outdir}/${outid}.cluster.log
           echo "sh $(pwd)/mysecript.sh $outid $files"  
       fi
    done

After the first if loop nothing in the script is running, I tried printing using echo nothing is showing up. Precisely, the issue is after the continue statement within the if loop. Any help/suggestions are much appreciated.

Thanking you

Aucun commentaire:

Enregistrer un commentaire