[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH 1/8] raisin: Fix non-verbose case



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 <george.dunlap@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.