vendredi 22 janvier 2016

How to find specific files in folders and do an operation in case they exist

I am having some difficulty doing a basic script in sh shell. What I want to do is simple though:

I want to do a sh script (can also be csh) that looks through a number of folders and for each folder that contain the files I am interested in, it should do a specific operation of pasting the corresponding filename into a sh script with rdseed commands.

The script I wrote in sh shell and doesnt work is:

for dir in EV*
do
    echo $dir
    cd $dir 
    if [ -f GEFLE* = true ];
    then
        set dataless = gur_ini_dataless.seed
        for file GEFLE*
        do
        echo "rdseed -d -o 2 -f "$file " -g " $dataless >> runmseed2ahGEFLE.sh
    done
    else
       echo "File does not exists"
    fi
    sleep 0.5
    cd ..
done

Anyone knows a solution?

Aucun commentaire:

Enregistrer un commentaire