bash - Sed command not working through SSH -


consider following command:

ssh machine sed -i 's#\[ "\$jboss_mode" = "standalone" \]#\[ "\$jboss_mode" = "sim_standalone" \]#' /tmp/sim-wildfly 

when run command command line, error:

sed: -e expression #1, char 3: unterminated `s' command 

however, when ssh particular machine first, , run sed part of command, works fine:

> ssh machine > sed -i 's#\[ "\$jboss_mode" = "standalone" \]#\[ "\$jboss_mode" = "sim_standalone" \]#' /tmp/sim-wildfly 

any idea why happen?

edit: believe has how i'm escaping characters, because tried simple test replacement no escaped characters , worked fine. tried double-escaping, didn't work either.

try ssh here-doc avoid crazy escaping:

ssh -t -t machine <<'eof' sed -i 's#\[ "\$jboss_mode" = "standalone" \]#\[ "\$jboss_mode" = "sim_standalone" \]#' /tmp/sim-wildfly exit eof 

Comments

Popular posts from this blog

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

html - Outlook 2010 Anchor (url/address/link) -

android - How to create dynamically Fragment pager adapter -