Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

how to replace a string by another string including space after twice ssh

I would like to change a string in a remote file after twice ssh login to modify

cake no

to

cake yes

(1)

sedscript='s/cake.*no/cake yes/g'
ssh host1 "ssh host2 sed -i $sedscript ~/test.config"

There is always the error.

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

(2) If change the regex as below,

sedscript='s/cake.*no/cake[[:space:]]yes/g'

The result will be

case[[:space:]]yes

Is there anyone who knows how to get the result "case yes"?

Comments