I got here by searching for a bash variable in regex
I solved this by changing the regex separators from "/" to "+"
Even if this has nothing to do with egrep, I add my solution for other people who come from similar searches:
SYBASELOG="/opt/sybase/ASE-12_5/install/SYBASE.log" MAILBODY="Some text and then the replacement placeholder: [MSGFILE] and some more text" # Some proecessing... MAILBODY=`echo "${MAILBODY}" | sed -e "s+\[MSGFILE\]+"${SYBASELOG}"+"`
And yes, now I see that this has little to do with bash and everything related to the slash in the log file variable. D'o!
source share