!/bin/bash
weird requirement to return a string
function finder { echo "A" }
temp=$(finder) echo "$temp"
!/bin/bash
function updatefile( ) { if [ $# -ne 2 ]; then echo "incorrect function parameters" exit 0 else echo "sed 's/$1/g' $2 -i" sed "s/$1/g" $2 -i fi }
VARIABLE CONFIGURATION
TARGETFILE="*/WEB-INF/app.properties"
DATABASEHOST="localhost:3306/10.10.10.193"
START PROCESSING
updatefile "$DATABASEHOST" "$TARGETFILE"
LOG CONFIG AND PROCESSING
TARGETFILE="*/WEB-INF/log4j.xml" DEBUGTOINFO="debug/INFO" updatefile "$DEBUGTOINFO" "$TARGETFILE"