Kev
Kev

Reputation: 51

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.

Upvotes: 5

Views: 2481

Answers (1)

Eugeniu Rosca
Eugeniu Rosca

Reputation: 5315

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

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

Upvotes: 6

Related Questions