I wrote this:
sudo sed -i ‘s/3389/3390/g’ /etc/xrdp/xrdp.iniThat produced this error:
sed: -e expression #1, char 1: unknown command: `' 0 2 Answers
Compare your
sudo sed -i ‘s/3389/3390/g’ /etc/xrdp/xrdp.inivs the correct
sudo sed -i 's/3389/3390/g' /etc/xrdp/xrdp.iniCheck the different type of quotes.
Be careful when copy-pasting from document editors like Writer or Word, those will often automatically change quotes (and other things) to match your locals.
1I had the same error but the cause was different. I did not use the ` character, nor did I copy-paste the code from somewhere. I was writing a sed script with a condition, and used a new line for the command. Posting this here in case someone else has the same problem and wasn't helped by the accepted answer.
Here is how to replicate the error:
echo class:myclass > myfile
cat script
/class:/
s/myclass/MYCLASS/g #ctrl+d to exit
sed -f script myfileOutput:
sed: file script line 2: unknown command: `
'What fixes it is either to place the command after the condition (on the same line), or use curly braces, so that the script looks like this:
/class:/ s/myclass/MYCLASS/Or this:
/class:/ {
s/myclass/MYCLASS/
}