From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gCyzR-0001Dz-Rc for qemu-devel@nongnu.org; Wed, 17 Oct 2018 23:28:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gCyzR-0000Xn-2C for qemu-devel@nongnu.org; Wed, 17 Oct 2018 23:28:49 -0400 References: <20181018031723.23459-1-maozhongyi@cmss.chinamobile.com> <20181018031723.23459-2-maozhongyi@cmss.chinamobile.com> From: Eric Blake Message-ID: Date: Wed, 17 Oct 2018 22:28:41 -0500 MIME-Version: 1.0 In-Reply-To: <20181018031723.23459-2-maozhongyi@cmss.chinamobile.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 1/3] qemu-iotests: Modern shellscripting (use $() instead of ``) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Mao Zhongyi , qemu-devel@nongnu.org Cc: kwolf@redhat.com, qemu-block@nongnu.org, mreitz@redhat.com On 10/17/18 10:17 PM, Mao Zhongyi wrote: > Various shell files contain a mix between obsolete `` > and modern $(); It would be nice to convert to using $() > everywhere. > > `pwd` and `basename $0` are in 231 files under directory > tests/qemu-iotests, so replaced it with the following: > > sed -i 's/`pwd`/$(pwd)/g' $(git grep -l "\`pwd\`") No. Instead, I'd rather a separate patch that does: s/`pwd`/$PWD/ s/\$(pwd)/$PWD/ since POSIX requires $PWD to be sane, and thus save us a wasted forked process. > sed -i 's/`basename $0`/$(basename $0)/g' $(git grep -l "basename \$0") > > A small amount of the rest is manually modified. > > Cc: kwolf@redhat.com > Cc: mreitz@redhat.com > Cc: qemu-block@nongnu.org > > Signed-off-by: Mao Zhongyi > --- > +++ b/tests/qemu-iotests/001 > @@ -21,10 +21,10 @@ > # creator > owner=hch@lst.de > > -seq=`basename $0` > +seq=$(basename $0) > echo "QA output created by $seq" > > -here=`pwd` > +here=$(pwd) > status=1 # failure is the default! At one point, someone (Jeff?) proposed a cleanup patch that got rid of a lot of cruft in iotests, including the fact that scripts that don't use $seq don't need to assign seq=$(basename $0). We should probably revive that rather than just making pointless churn on stuff that is garbage anyways. But I don't have time to look up a URL to that older series at the moment. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org