#!/bin/sh # nospaces-files -- rename files with spaces in their names with underscores # # AUTHOR: Gary T. Leavens ret=0 for f do NEWNAME=`echo "$f" | tr ' ' '_'` if test -f "$NEWNAME" then echo "not renaming $f, as $NEWNAME exists!" 2>&1 ret=1 else echo "renaming $f as $NEWNAME ..." mv "$f" "$NEWNAME" || ret=1 fi done exit "$ret"