I am trying to run a variable sed
command depending on user input:
#!/bin/bash
ACTION=$1
if [ "wp" == "$ACTION" ]
then
MODIFIEDCONF='sed -i -e "/#Begin wp redirect/,/#End wp redirect/d" /root/test-conf'
else
MODIFIEDCONF='sed -i -e "/#Begin ghost redirect/,/#End ghost redirect/d" /root/test-conf'
fi
RESULT=$($MODIFIEDCONF)
But I am getting the error:
sed: -e expression #1, char 1: unknown command: `"'
How do I fix the error? Or is there a better way to do it?