Wow that script is really badly written. All I can say is run script as follows to see what is going on:
Code:
sh -x config_replace somemachine ${SRC_DIR}/some.conf ${TARGET_DIR}/some.conf
or better pass -v option too
Code:
sh x- v- config_replace somemachine ${SRC_DIR}/some.conf ${TARGET_DIR}/some.conf
Above two statements will give you lots of debugging info.