if [ "$1" = "" ]; then
	echo "Usage: ./setParam <file> <parameter to add> <paramter to remove>"
	exit
fi


if [ "$2" = "" ]; then
	echo "Usage: ./setParam <file> <parameter to add> <paramter to remove>"
	exit
fi

if [ "$3" = "" ]; then
	echo "Usage: ./setParam <file> <parameter to add> <paramter to remove>"
	exit
fi
param1=`grep "^$2" $1`

if [ "$param1" = "" ]; then
	echo "Param not present";
else
	echo "Param already present";
	exit
fi

param=`grep "^$3" $1`

if [ "$param" = "" ]; then
	echo "Appending..."
	echo "$2" >> $1 
else
	echo "Replacing.."
	echo "s/^$3/$2/" > /tmp/cmd
	sed -i -f /tmp/cmd $1 
	rm -f /tmp/cmd 
fi
