You must add a newline in your
sed command (and then account for the shell's handling of escaped newlines):
\t\t\t\tflags: ['--no-sandbox']" build/unit-test.coffee
As the GNU
sed manual says:
text Append text, which has each embedded newline preceded by a backslash.
This is not very clear, unformatted like this. (It isn't particularly clearer when viewed with the
man command, alas.) What it is telling you is that the format of the
a command includes a backslash, a newline, and then an argument denoted by text. Everything in that column on the left, in other words.
As noted in question comments,
seds differ in how they handle malformed commands. Spinellis
sed yields an error, telling you that you have something other than the required backslash followed by newline:
% sed "/^\t\tkarmaServer.start/a\t\t\t\tflags: ['--no-sandbox']" /dev/null
sed: 1: "/^\t\tkarmaServer.start ...": extra characters after \ at the end of a command
Your particular choice of
sed appears to be simply treating the rest of the line as the text argument. But the first backslash there is still counting as the mandatory backslash that should follow
a. Therefore, what you end up with as the text argument is
Notice the initial
t, and one fewer tabs than you expected.