appending data to file

Hi.

I wrote a very simple script and it doesn't work :frowning:
It is supposed to go to a certain directory, execute some command and append the output to the file "expo.dat"

what it does is that it writes to the file only one entery. I dont know if Im using the write synthax for "append". Here is the code

directory= /Desktop
file=$directory/list.dat

echo $file
while read listID
do
cd $directory/$listID
some-command >>expo.dat
done < $file

thanks

Is it possible that your $file only has one entry?

no it has 100 entries
and the loop is executed 100 times (used echo to check)

Got it!!
the code creats a new file in the changed-to directory and dumps the output there!! I specified the directory for the output file and it works now.

Thanks