Hi everybody, I'm trying to make a script that compare two directories, one original, and one backup. I want it to remove files in backup one that have been deleted in the original one. Here is what i've done so far : #!/bin/bash Y=$( ls -RF /home/charlie/img01/ | grep : | sed 's/\:.*//' | sed -ne $""$NUMBER""p ) Ybackup=$( ls -RF /home/charlie/essai/ | grep : | sed 's/\:.*//' | sed -ne $""$NUMBER""p ) for NUMBER in $( ls -RF /home/charlie/img01 | grep : | sed 's/\:.*//' | awk '{ print NR, $0 }' | cut -b 1); do for x in $( ls $Ybackup ); do ls $Y/$x if [ $? != 0 ]; then rm $Ybackup/$x fi done done The problem is that i would like to do the all action with one value of $NUMBER, and then with the next one ... Ybackup=$( ls -RF /home/charlie/essai/ | grep : | sed 's/\:.*//' | sed -ne 1p ) Ybackup=$( ls -RF /home/charlie/essai/ | grep : | sed 's/\:.*//' | sed -ne 2p ) ... instead of this i've got this : Ybackup=$( ls -RF /home/charlie/essai/ | grep : | sed 's/\:.*//' | sed -ne 1 2 3 4 5 p )