copy all files with one extension to files with another extension

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

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