qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v10 03/13] scripts: Add archive-source.sh


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v10 03/13] scripts: Add archive-source.sh
Date: Thu, 21 Sep 2017 08:36:07 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0

On 09/20/2017 07:45 PM, Fam Zheng wrote:
>>
>> has a flaw that $? is no longer what you want, at which point you would
>> have to introduce a temporary variable.  But we're using bash, so you
>> can instead write this as:
>>
>> if test "address@hidden" != "0 0"; then
> 
> Hmm, with exactly this line here I get something like:
> 
> ./scripts/archive-source.sh: line 36: test: too many arguments

D'oh - address@hidden causes word splitting (same as "$@"); we want [*] instead:

if test "${PIPESTATUS[*]}" != "0 0";

> 
> But with
> 
>     if test "${PIPESTATUS[0]} ${PIPESTATUS[1]}" != "0 0"; then

or that's a manual way of spelling the auto-array-concatenation that you
get with [*].

> 
> it seems to work fine. What is the magic here?
> 
> Fam
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]