qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Jeff Cody" <jcody@redhat.com>,
	"Benoît Canet" <benoit.canet@irqsave.net>
Cc: kwolf@redhat.com, qemu-devel@nongnu.org, stefanha@redhat.com
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	[thread overview]
Message-ID: <5329A977.5030801@redhat.com> (raw)
In-Reply-To: <20140319141948.GA4189@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 923 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2014-03-19 14:28 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18  1:24 [Qemu-devel] [PATCH 0/4] Add common QEMU control functionality to qemu-iotests Jeff Cody
2014-03-18  1:24 ` [Qemu-devel] [PATCH 1/4] block: qemu-iotests - add common.qemu, for bash-controlled qemu tests Jeff Cody
2014-03-19 13:39   ` Benoît Canet
2014-03-19 14:19     ` Jeff Cody
2014-03-19 14:28       ` Eric Blake [this message]
2014-03-19 14:32         ` Eric Blake
2014-03-19 14:45         ` Jeff Cody
2014-03-19 14:53           ` Eric Blake
2014-04-10  2:03   ` Fam Zheng
2014-03-18  1:24 ` [Qemu-devel] [PATCH 2/4] block: qemu-iotests - update 085 to use common.qemu Jeff Cody
2014-03-19 13:44   ` Benoît Canet
2014-03-18  1:24 ` [Qemu-devel] [PATCH 3/4] block: qemu-iotests - fix image cleanup when using spaced pathnames Jeff Cody
2014-03-19 13:46   ` Benoît Canet
2014-03-18  1:24 ` [Qemu-devel] [PATCH 4/4] block: qemu-iotests: make test 019 and 086 work with " Jeff Cody
2014-03-19 13:47   ` Benoît Canet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5329A977.5030801@redhat.com \
    --to=eblake@redhat.com \
    --cc=benoit.canet@irqsave.net \
    --cc=jcody@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).