I'm going crazy on a simple thing. I have written the following line that is amazingly working:
name=$(echo $name | sed 's/"//g' | sed 's/^ //' | sed 's/ $//' | sed "s/'/\\\'/")
I'm trying to reduce sed to only one command instead of four, and I wrote the following line that doesn't work, and I cannot manage to make it work:
name=$(echo $name | sed 's/"//g; s/^ //; s/ $//; s/\'/\\\'/g')
I get:
sed: 1: "s/"//g; s/^ //; s/ $//; ...": unterminated substitute in regular expression
What am I doing wrong? I can't see the syntax error, I've tried to rewrite it many times, the line with 4 sed works, but this where I try to put all in one sed it doesn't.
Thank you very much for your help!