comparison src/chg @ 0:6ee11bf9e3ea

Initial revision
author jcid
date Sun, 07 Oct 2007 00:36:34 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:6ee11bf9e3ea
1 #!/bin/sh
2 #
3 # Shell script for name changing source code
4 #
5
6 if [ ! $# = 3 ]; then
7 echo "Usage: chg <source> <old_word> <new_word>"
8 echo " (this script changes <source> directly)"
9 exit 1
10 fi
11
12 if [ ! -r $1 ]; then
13 echo "source file ->$1<- doesn't exist..."
14 exit 1
15 fi
16
17 if [ ! -r $1.BAK ]; then
18 echo "creating backup file: $1.BAK"
19 cp $1 $1.BAK
20 fi
21
22 sed "s/$2/$3/g" $1 > out
23 #sed s/$2/$3/ $1 > out
24 rm $1
25 mv out $1
26 echo "done!"
27
28