Jim Meyering
2008-Jun-15 21:00 UTC
[Ovirt-devel] [PATCH 4/4] build-all.sh: Avoid unnecessary "grep" in IP-addr-extraction code
save a pipe/process>From 488ca2d17d6b654b85ccd146a98aacbc5c62532f Mon Sep 17 00:00:00 2001Date: Sun, 15 Jun 2008 14:55:43 +0200 Subject: [PATCH] * build-all.sh: Avoid an unnecessary "grep" in IP-addr-extraction code. --- build-all.sh | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/build-all.sh b/build-all.sh index eb9c848..e681f18 100755 --- a/build-all.sh +++ b/build-all.sh @@ -226,7 +226,8 @@ fi # NOTE: create-wui-appliance.sh must be run as root if [ $update_app == 1 ]; then # FIXME: This can go away once we have livecd tools building the appliances - VIRBR=$(virsh net-dumpxml default | grep "<ip address=" | sed "s/.*ip address='\(.*\)' .*/\1/") + VIRBR=$(virsh net-dumpxml default \ + | sed -n "s/.*ip address='\([^.]*\)' .*/\1/p") test -z $VIRBR && die "Could not get ip address of default network for app" cd $BASE/wui-appliance -- 1.5.6.rc2.47.g075fa
Chris Lalancette
2008-Jun-16 07:11 UTC
[Ovirt-devel] [PATCH 4/4] build-all.sh: Avoid unnecessary "grep" in IP-addr-extraction code
Jim Meyering wrote:> diff --git a/build-all.sh b/build-all.sh > index eb9c848..e681f18 100755 > --- a/build-all.sh > +++ b/build-all.sh > @@ -226,7 +226,8 @@ fi > # NOTE: create-wui-appliance.sh must be run as root > if [ $update_app == 1 ]; then > # FIXME: This can go away once we have livecd tools building the appliances > - VIRBR=$(virsh net-dumpxml default | grep "<ip address=" | sed "s/.*ip address='\(.*\)' .*/\1/") > + VIRBR=$(virsh net-dumpxml default \ > + | sed -n "s/.*ip address='\([^.]*\)' .*/\1/p")This is fine, but maybe we should change also then change the sed part of it to look for ".*<ip address='\([^.]*\)' .*" instead? Not really a big deal anyway, just a minor cleanup. Chris Lalancette