I have a perl inline replace command in a shell script that isn't working for some reason. With below command, its replacing all ":" with replacement string in the perl command.
When I manually ssh to the box and running the perl command works as expected.
ssh host "cd /x/somedirectory && perl -pi -e 's#\${somehost}:\${someport}#10.20.30.40:8443#g' config/app.properties"
Edit1
Please note that $somehost and $someport are NOT shell variables. I'm looking for a literal text replacement.
What am I doing wrong? I tried using different delimiters, escaping { and } etc but still no luck.
somehostandsomeportmust not be defined then.$somehostand$someportare not shell variables. I'm looking for a literal text replacement. I'm editing the questionNet::SSH. Or failing that, put the code from the one-liner inside a file, and run it likessh host "perl -pi code.pl /x/somedir/config/app.properties