3 # takes names given to it and replaces any spaces or other gnarly characters with underscores.
5 #hmmm: this starts to look like a useful function that the bracket fixer could also use.
8 echo "This script requires one or more file names whose names should be fixed."
9 echo "Any spaces or single-quote characters will be stripped out in a useful way."
13 while [ $# -gt 0 ]; do
15 newname="$(echo "$file" | tr -s ' ' '_' | tr -d "\\\~'," | sed -e 's/\([0-9]\)_\./\1./g' | sed -e 's/_-_/-/' )"
16 if [ "$file" != "$newname" ]; then
17 # we've effected a name change, so let's actually do it.
18 echo "moving '$file' => '$newname' "