qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 1/4] block: qemu-iotests - add common.qemu, for


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 1/4] block: qemu-iotests - add common.qemu, for bash-controlled qemu tests
Date: Wed, 19 Mar 2014 08:28:07 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 03/19/2014 08:19 AM, Jeff Cody wrote:

>>> +    then
>>> +        _timed_wait_for ${h} "${@: -1}"
>>
>> You have done shift before this. Aren't ${*} the remaining strings to wait 
>> for ?
>>
> 
> I could probably get rid of the 2nd shift, although I would have to
> adjust the conditional below.  
> 
> I do ${@: -1} because I want the very last whole string to be the item
> to wait for - this is only needed to accommodate pathnames with spaces
> inside the QMP string.

${@: -1} is not portable:

$ bash -c 'set 1 2 3; echo ${@: -1}'
3
$ dash -c 'set 1 2 3; echo ${@: -1}'
dash: 1: Bad substitution

If you want the last argument, you'll have to do something hideous like:

eval \${$#}

Short of using eval, there is no portable way to get at the last
positional argument in dash.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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