1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
#!/bin/bash
CONFIG="tmp/wip/config.h"
# This script changes all definitions of elements in $CONFIG in the
# file passed as arg 1, generating arg 2.
# The default path to the macro files in $CONFIG can be overrules
# by a 3rd argument.
case $# in
(3)
YODL_BIN=`grep YODL_BIN $CONFIG | cut -d\" -f2`
VERSION=`grep VERSION $CONFIG | cut -d\" -f2`
STD_INCLUDE=$3
;;
(*)
echo "Usage: $0 xxx.in xxx.yo path-to-macro-files"
exit 1
;;
esac
# Create the destination file, changing @... into the required
# values
#
sed '
s,@STD_INCLUDE@,'$STD_INCLUDE',g
s,@YODL_BIN@,'$YODL_BIN',g
s,@VERSION@,'$VERSION',g
' $1 > $2
|