|
|
#!/bin/bash
DIR="${0%/*}"
compile_template() { tr '\n' '|' | sed -e 's/\\/\\\\/g' -e 's/|*$//' -e 's/|/\\n/g' -e 's/$/\\n\n/' -e 's/&/\\&/g' -e 's/,/\\,/g' }
for x in $DIR/*.in; do name="$( echo "$x" | sed -e 's,.*/,,' -e 's,\.in$,,' | tr 'a-z' 'A-Z' )" value="$( cat $x | compile_template )" echo "s,@@$name@@,$value,g;" done
sed -e '/^#/d;' -e 's,[ \t]*#.*,,' -e '/^[ \t]*$/d;' -e 's/=/ /' "$DIR/servers.txt" | while read name value; do echo "s,@@$name@@,$value,g;" done
|