Article 5CMJP [SOLVED] sed: -e expression #1, char 23: unterminated `s' command

[SOLVED] sed: -e expression #1, char 23: unterminated `s' command

by
shams
from LinuxQuestions.org on (#5CMJP)
This code will get the new ip address of the wlan0 in each new network connections and then will update the whole line beginning with 192 in /etc/hosts:
Code: ip="$(ip addr ls wlan0 | grep '\<inet\>' | cut -d' ' -f6 | cut -d'/' -f1)"
echo $ip | sed -i 's/^192.*/'$ip' example.com exmaple.org/' hostsbut when i run this code git this error:
Code:sed: -e expression #1, char 23: unterminated `s' commandlatest?d=yIl2AUoC8zA latest?i=kcZRo9XrngQ:3EBS_CIR__g:F7zBnMy latest?i=kcZRo9XrngQ:3EBS_CIR__g:V_sGLiP latest?d=qj6IDK7rITs latest?i=kcZRo9XrngQ:3EBS_CIR__g:gIN9vFwkcZRo9XrngQ
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments