Reputation: 1437
when issuing this command:
sed -i 's/"ExecStart=-/sbin/agetty --noclear %I $TERM"/"ExecStart=-/sbin/agetty --noclear -a root %I $TERM"/g' /lib/systemd/system/[email protected]
or
sed -i s/"ExecStart=-/sbin/agetty --noclear %I $TERM"/"ExecStart=-/sbin/agetty --noclear -a root %I $TERM"/g /lib/systemd/system/[email protected]
or
sed -i s/'ExecStart=-/sbin/agetty --noclear %I $TERM'/'ExecStart=-/sbin/agetty --noclear -a root %I $TERM'/g /lib/systemd/system/[email protected]
I get the following error:
sed -i 's/"ExecStart=-/sbin/agetty --noclear %I $TERM"/"ExecStart=-/sbin/agetty --noclear -a root %I $TERM"/g' /lib/systemd/system/[email protected]
sed: -e expression #1, char 21: unknown option to `s'
What am I doing wrong here?
Upvotes: 1
Views: 138
Reputation: 85845
Change the de-limiter string from /
to something else like ;
when trying to replace character strings involving /
in the substitution part.
sed -i.bak 's;"ExecStart=-/sbin/agetty --noclear %I $TERM";"ExecStart=-/sbin/agetty --noclear -a root %I $TERM";g' /lib/systemd/system/[email protected]
Upvotes: 1
Reputation: 195229
sed -i "s#ExecStart=-/sbin/agetty --noclear %I $TERM#ExecStart=-/sbin/agetty --noclear -a root %I $TERM#g" /lib/systemd/system/[email protected]
The above line should go, give it a try!
Your problem:
"s/foo$var1/bar$var2/g"
s/../../
slash or use other separator.Upvotes: 2