vendredi 1 décembre 2017

Using the output of if statement (cmp) in a cp command

I am trying to use the output of an if statement as input for a cp command, but it does not seem to work. My code is:

if cmp $2/$filename $fname; then 
cp $fname $2/$filename.JPG
fi

I think the cp statement is incorrect, as the cmp only gives the difference between the files and then executes the cp if there is a difference. I already copied the files with a for loop, now I am trying to rename and copy the different ones that have same names.

Aucun commentaire:

Enregistrer un commentaire