diff options
Diffstat (limited to 'src/xpm/rename')
-rwxr-xr-x | src/xpm/rename | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/xpm/rename b/src/xpm/rename new file mode 100755 index 0000000..a767d5e --- /dev/null +++ b/src/xpm/rename @@ -0,0 +1,24 @@ +#!/bin/sh +# rename is provided to easily update code using sed-command files + +USAGE='rename sed-command-file file1 file2... + apply all sed-command-file to the files file1 file2 +' + +if test "$1" = '-?'; then echo "$USAGE";exit 1;fi +commands=$1 +shift + +for i in $* +do if test -f $i + then echo -n "$i: " + echo -n "." + sed -f $commands $i > /tmp/rename.sed.$$; + if test ! -s /tmp/rename.sed.$$; then rm /tmp/rename.sed.$$; exit 1;fi + if cmp /tmp/rename.sed.$$ $i >/dev/null; then echo + else cp $i $i.BAK; cp /tmp/rename.sed.$$ $i; echo " modified." + fi + fi +done + +rm -f /tmp/rename.sed.$$ /tmp/rename.sed.$$.org |