Hello, I have a script that does some imageMagick stuff in a for-loop and save the results in sub-directories. Normally it works perfect, but in a certain condition it produces a strange result I cannot explain. I start the script in my /home/daniel/digikam folder with ./scriptname.sh It cd's to the directory containing the files that should be transformed and the for-loop searches for all *.png files, like: cd to png-directory for bild in *.png do resize $bild, add text, save ${bild%.png}.jpg as JPEG-image in sub-directory ./4000 add color profile to ./4000/"${bild%.png}.jpg" done (The original script resizes to 2 sizes into 2 sub-directories, adds a color-profile and then converts to new color-profile to both versions, it is here: https://www.daniel-bauer.com/div/strange_script.txt) Now when I have NO png-files (but jpg-files) in the "png-directory", in my opinion the script should do just nothing, because there is nothing to process in the for-loop. But what happens is: All files that already have been in the sub-directories before are copied to a file with the name of the last file that already was in that sub-directory, plus a number. [to explain: there are already 3 files A.jpg, B.jpg, C.jpg in the sub-directory before I start the script. After the script executed I have there addditional: C-0.jpg, C-1.jpg, C-3.jpg ... ... C-32.jpg ... ... where those C-n-files are copies of A, B and C.jpg ] Where is my error? Why does the script do anything, when the condition for the for-loop isn't met (there are no *.png-files to process)? Thanks for your help! Daniel -- Daniel Bauer photographer Basel Málaga Twitter: @Marsfotografo (often explicit nudes) https://www.patreon.com/danielbauer https://www.daniel-bauer.com (nudes)