change extensions for all files with a specific extension

rename all files in current directory with the extension bar to equal filenames with the extension foo

for f in *.bar; do mv $f $f.foo; done