Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 Mar 2017 23:05:11 -0600
From:      Alan Somers <asomers@freebsd.org>
To:        Cy Schubert <Cy.Schubert@komquats.com>
Cc:        =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= <des@des.no>, scrappy@freebsd.org,  Brian Somers <brian@freebsd.org>, freebsd-bugzilla@ayaken.net,  Cy Schubert <cy@freebsd.org>, pkg@freebsd.org
Subject:   Re: Bug 217055 - Consolidate random sleeps in periodic scripts
Message-ID:  <CAOtMX2gvrNay-6pCbYQK08wY%2BneBzdDeirL%2Brh03kKDhdhK=pQ@mail.gmail.com>
In-Reply-To: <201702162026.v1GKQivr096824@slippy.cwsent.com>
References:  <des@des.no> <86zihmwlth.fsf@desk.des.no> <201702162026.v1GKQivr096824@slippy.cwsent.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 16, 2017 at 1:26 PM, Cy Schubert <Cy.Schubert@komquats.com> wro=
te:
> In message <86zihmwlth.fsf@desk.des.no>, =3D?utf-8?Q?Dag-Erling_Sm=3DC3=
=3DB8rgrav?
> =3D w
> rites:
>> Cy Schubert <Cy.Schubert@komquats.com> writes:
>> > "Dag-Erling Sm=C3=B8rgrav" <des@des.no> writes:
>> > > This won't work, because && forks.  You need:
>> > >
>> > >    if [ -t 0 ] ; then ... ; fi
>> > Are you sure?
>>
>> Maybe it varies from shell to shell...  or maybe I confused it with
>> other constructs like 'grep foo bar | while read line' (which definitely
>> doesn't work).  I consider it bad style, but that's a matter of taste.
>> I prefer to use && and || only for error conditions and loop control.
>
> Maybe. I tested this on Bourne, ksh, bash, zsh, csh and 44bsd-csh on
> FreeBSD and bash on Linux. I don't have access to any Solaris or AT&T
> servers any more. (I am told that Solaris 11 replaced /bin/sh with bash.)
>
> If the command after a test is a one-liner, like my proposed patch, then =
I
> prefer to put it on the same line. If it's more than one line then it
> should go in an if block. Otherwise it's ugly and hard to follow. Just a
> difference in preference I suppose.

Under review at https://reviews.freebsd.org/D10211 .  Please direct
further discussion to the review.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOtMX2gvrNay-6pCbYQK08wY%2BneBzdDeirL%2Brh03kKDhdhK=pQ>