0

I want to replace the below string

su - oracle -c "$agent_home/bin/emctl control agent runCollection ex01cel01:oracle_exadata oracle_exadata_configuration"

to replace with

su - oracle -c "'$agent_home'/bin/emctl control agent runCollection ex01cel01 :oracle_exadata oracle_exadata_configuration"

note:extra single quotes covering the $agent_home

Please help me

iamauser
  • 11,119
  • 5
  • 34
  • 52

1 Answers1

1

The following sed command should do it

sed "s|\$agent_home|'\$agent_home'|"
  • 1
    or `sed 's/$agent_home/\x27&\x27/'` to avoid worrying about escaping shell interpretations in double quotes – Sundeep Mar 17 '17 at 16:03