BASH: Rename multiple files with sequential number at end

Spent way too much time trying to do this, hope this help someone else:

i=1;for f in *.jpg; do mv "$f" "newname$i.jpg"; let i++; done