1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#!/bin/sh IFS=' ' if [ -z "$3" ] ; then echo usage: $0 from to file_list exit 1 fi from="$1" to="$2" shift shift for i in $* ; do new=$(echo $i | sed "s/$from/$to/g") echo cp $i $new cp $i $new done