Date: Tue, 3 Aug 2010 13:46:55 -0400 From: John Baldwin <jhb@freebsd.org> To: "Dag-Erling =?utf-8?q?Sm=C3=B8rgrav?=" <des@des.no> Cc: Garrett Cooper <yanefbsd@gmail.com>, current@freebsd.org Subject: Re: RFC: etcupdate tool in base? Message-ID: <201008031346.56093.jhb@freebsd.org> In-Reply-To: <864oh4poxa.fsf@ds4.des.no> References: <201006101346.59824.jhb@freebsd.org> <AANLkTikREfDupHi3mnCdUdwXt015KorPvbVGqxwW4MkC@mail.gmail.com> <864oh4poxa.fsf@ds4.des.no>
index | next in thread | previous in thread | raw e-mail
On Tuesday, June 15, 2010 6:31:45 am Dag-Erling Smørgrav wrote: > Garrett Cooper <yanefbsd@gmail.com> writes: > > 1. Script doesn't check to see whether or not it has write access (and > > doesn't catch some errors): > > IMHO, any shell script which is intended to be used more than twice > should start with "set -e". It turns out that this can be quite a PITA to workaround if you have commands that don't fail, but return "status". I use a shell function which uses $? to return an enum of the result of comparing two files. Using -e for that requires many odd workarounds. A better case is diff(1). I use diff(1) to generate diff output for 'etcupdate diff' so you can generate a patch of your local changes to etc. However, diff returns $? of 1 if it detects a difference which is not a failure, but sh -e treats as a failure. This would require gross hacks along the line of "|| true" or some such which obfuscate the code. -- John Baldwinhome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201008031346.56093.jhb>
