Error in sed

Hello,

I want to remove .txt from every file name:

for file in *.txt; des=$(echo $file | sed 's/\.txt//'); mv "$file" "$des"; done 

but this gives me:

bash: syntax error near unexpected token `des=$(echo $file | sed 's/\.txt//')'

I understand that there's other ways of doing this but I am wondering why my method doesn't work.

Thank you.

You forgot to do the do

for file in *.txt; do des=$(echo $file | sed -e 's/\.txt//'); mv "$file" "$des"; done