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

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

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -