#!/bin/sh # Use a text editor to rename files -- invoke as "mve *.txt". tempfile=/tmp/mve.$$ echo 'm () { [ "$1" = "$2" ] || mv "$2" "$1"; }' >$tempfile || exit 1 echo '# Edit first name' >>$tempfile for x in "$@" ; do echo "m \"$x\" \"$x\"" >>$tempfile done $EDITOR $tempfile || exit 1 sh $tempfile rm -f $tempfile