Hi All,
I apologise even though my previous posts were not intended to offend
or humiliate. As a coder supporting Devuan, my first preoccupation is
to get code to do what it is intended for. I am giving support by
coding to Devuan in my now very limited free time.
Since .desktop files are not user data files and are also small text
files, I decided in favour of replacing the entire file instead of
trying more complicated solutions to replace only what was changed.
The overhead if any should not be noticeable for users as the
rewritten files are very small.
Edward
On 08/01/2016, aitor_czr <aitor_czr@???> wrote:
> On 01/08/2016 01:58 PM, Rainer Weikusat wrote:
>>> >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).
>
> Thanks, Rainer, it works :)
>
> Aitor.
>