Error with sed unterminated s command in bash

I'm having a problem with using sed in a bash script. Here is the line:

sed -i "s/"$name"/"$input"/g" ~/input.script

I'm getting this error: sed: -e expression #1, char 24: unterminated `s' command

Weirdly enough it was working in an earlier version of my code. I've been trouble shooting but I cannot find a solution.


You don't need nested quotes. Also, try changing the delimeter:

sed -i "s@$name@$input@g" ~/input.script