Problem scenario
You have a sed command in a script, but you get an error like one of the following:
sed: -e expression #1, char 1: unknown command: '' sed: -e expression #1, char 1: unknown command:
"'
How do you troubleshoot this?
Solution
You may need to assign variables like this:
var1=" foo""'"" bar"
# Place quotes around any unusual characters (e.g., spaces or punctuation)
Use the escape character:
var2="info \'"
Combine the subvariables into one variable:
compvar=$var1$var2
See this posting if you have any further questions.