I need to replace a literal variable value in a file, I'm trying to use SED but it doesn't seem to be working. Below is the command I'm using, but when I check the file the value hasn't changed.
sed -i .bak "s|isJBossRunning \\\${home}|isJBossRunning \\\${home_dir}|g" /file/location/file.sh
Here is an example of what I'm trying to do. In my file.sh file.
home='/opt/tmp'
home_dir='/usr/share/jbossas'
JBOSS_USER=jbossas
SERVER_NAME=abxd
echo isJBossRunning ${JBOSS_USER} ${home} ${SERVER_NAME}
So what I want to do is replace the string isJBossRunning ${JBOSS_USER} ${home} ${SERVER_NAME}
so I replace the ${home}
with ${home_dir}
.