{i%l} already exists
else
mv $i ${i%l}
fi
done
Substitution
Another kind of variable mangling y... a little ungainly.
So, bash (which long ago abandoned the "small is beautiful" principal and went the ... n into a list of filenames (called "globbing") is done by the shell -- before the command is executed. T... result:
for i in *.txt; do cp $i ${i%.txt}.bak; done
... obviously this is more typing. If you tried