added the make package target. Builds a faxien style package.
[otp-base.git] / tools / .appgen / substitute.sh
blob12d2e49943194f6a143c0c7efa9c4f8f35099e41
1 #!/bin/sh
4 if [ "$#" = "2" ]; then
5 echo "usage: substitute.sh <variable to replace> <value to replace with> <filename | STDIN>"
6 exit 1
7 fi
9 if [ "$#" = "3" ]; then
10 VARIABLE=$1
11 VALUE=$2
12 FILENAME=$3
14 echo "replacing $VARIABLE with $VALUE in $FILENAME"
15 sed -e "s/$VARIABLE/$VALUE/" $FILENAME > "$FILENAME"_tmp
16 mv "$FILENAME"_tmp $FILENAME
17 exit 0
20 if [ "$#" = "2" ]; then
21 while read line;
23 VARIABLE=$1
24 VALUE=$2
25 FILENAME=${line}
27 echo "replacing $VARIABLE with $VALUE in $FILENAME"
28 sed -e "s/$VARIABLE/$VALUE/" $FILENAME > "$FILENAME"_tmp
29 mv "$FILENAME"_tmp $FILENAME
30 done
31 exit 0