From: Stefano Stabellini Subject: Re: [PATCH 1/8] raisin: Fix non-verbose case Date: Fri, 17 Apr 2015 11:06:59 +0100 Message-ID: References: <1429201182-1044-1-git-send-email-george.dunlap@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1429201182-1044-1-git-send-email-george.dunlap@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: George Dunlap Cc: xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On Thu, 16 Apr 2015, George Dunlap wrote: > Because we use "set -e", we can't use the "a && b" construct, as it will fail and stop the script. > > Signed-off-by: George Dunlap I am wondering whether we should ban both a && b and a || b from the code and just go with the more verbose but also harder to get wrong: if [[ $VERBOSE -eq 1 ]] then echo calling "$component"_"$1" fi Reading the code and seeing a || b will tempt you into writing a && b. > lib/common-functions.sh | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/lib/common-functions.sh b/lib/common-functions.sh > index 36e1766..06c894a 100644 > --- a/lib/common-functions.sh > +++ b/lib/common-functions.sh > @@ -232,9 +232,9 @@ function for_each_component () { > fi > if eval [[ ! -z \$"$capital"_REVISION ]] > then > - [[ $VERBOSE -eq 1 ]] && echo calling "$component"_"$1" > + [[ $VERBOSE -eq 0 ]] || echo calling "$component"_"$1" > "$component"_"$1" > - [[ $VERBOSE -eq 1 ]] && echo "$component"_"$1" done > + [[ $VERBOSE -eq 0 ]] || echo "$component"_"$1" done > fi > done > } > -- > 1.9.1 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel >