Remove Spaces From Filenames

How to delete spaces from file names on Unix systems using shell:

for f in *; do mv "$f" `echo $f | tr ' ' '_'`; done