On Mon, Jan 24, 2011 at 02:17:48PM +0100, Harald Jenny wrote: > Hi Augustin > > On Sun, Jan 23, 2011 at 01:38:47AM +0100, Agustin Martin wrote: > > 2011/1/21 Teodor MICU <mteo...@gmail.com>: > > > 2011/1/21 Agustin Martin <agmar...@debian.org>: > > >> if [ "$MILTERSOCKET" ] && [ "`echo $MILTERSOCKET | grep -v ^inet`" ]; > > >> then > > >> > > >> but as Teodor points out (just read it), second check seems to be enough. > > > > > > Only that I realized latter the intention of this construction. My > > > previous suggestion was to use this construction on its own without > > > "test": > > > > > > if echo "$MILTERSOCKET" | grep -q -v "^inet"; then > > > ... > > > fi > > > (the return code is set by grep) > > > > > > This works too but there is an extra test for the empty string: > > > if [ "$(echo $MILTERSOCKET | grep -v ^inet)" ]; then > > > ... > > > fi > > > (the return code is set by 'test') > > > > If I understand correctly, first expression saves redundant checks, so > > is preferrable. > > I will have a to check this - this is meant as a guard against accidently > setting $MILTERSOCKET to "".
Damm, seems I wrongly understood Theodor's mail, and my proposed change will not work because of echo newline. Anyway, in the case above, 'echo -n' (allowed by policy 10.4) http://www.de.debian.org/doc/debian-policy/ch-files.html#s-scripts should help with that, if echo -n "$MILTERSOCKET" | grep -q -v "^inet"; then That will still not protect against things like setting $MILTERSOCKET to " ", but dealing with "" is a must. -- Agustin -- To UNSUBSCRIBE, email to debian-bugs-rc-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org