I'm trying to write a script to change spaces in a filename to the underscore character: #!/bin/sh for i in *; do if test -f $i; then mv $i `echo $i | tr '" "' '_'` fi done When run, it gives me the error "too many args in line four." How can I fix this? Thanks, Jeff Elkins