Web lists-archives.com

Re: Which checks should we mandate for source operations in shell scripts




On Wed, 20 Jun 2018 22:01:41 +0100, Simon McVittie <smcv@xxxxxxxxxx>
wrote:
>On Wed, 20 Jun 2018 at 21:49:29 +0200, Marc Haber wrote:
>> It has (finally, and to late) occurred to me that
>> 
>> |# back up /etc/default/foo
>> |cp /etc/default/foo ~/foo
>> |(try something in /etc/default)
>> |sudo mv ~/foo /etc/default/foo
>> 
>
>For your use-case above, I'd suggest sudoedit(8), which copies the file
>to be edited into /var/tmp, runs your $EDITOR as you, and if the file
>was modified by the time your editor exits, copies it back.

That doesn't help here. One needs to do the backup with elevated
privileges.

Greetings
Marc
-- 
-------------------------------------- !! No courtesy copies, please !! -----
Marc Haber         |   " Questions are the         | Mailadresse im Header
Mannheim, Germany  |     Beginning of Wisdom "     | 
Nordisch by Nature | Lt. Worf, TNG "Rightful Heir" | Fon: *49 621 72739834