Author: Rainer Weikusat Date: To: Edward Bartolo CC: dng, aitor_czr Subject: Re: [DNG] netman-autostart_0.1.1
Edward Bartolo <edbarx@???> writes: >> printf 'g/^Comment=/d\na\n%s\n.\nwq\n' "$comment" | ed netman.desktop [*]
>
> Hi,
>
> I tried to use the above command instead of:
>
> sed -i "/Exec=netman/c\ ${line}" "${launcher}"
>
> but found that it corrupts the destination .desktop file.
Maybe your copy did that (in this case, posting the copy and the result
could be very helpful) but mine surely doesn't. Written out, the script
is
g/^Comment=/d
Delete all lines starting with Comment=
a
Enter append mode.
<$comment is interpolated here>
If $comment is a single ., append mode will immediately be exited
again. No other editor commands will be interpreted.
.
End append mode.
wq
Write changes to file and terminate ('wq' is not really a UNIX(*) ed
command but GNU ed supports it).