Date: Tue, 21 Jul 2009 14:35:51 +0300 From: Giorgos Keramidas <keramida@freebsd.org> To: chris scott <kraduk@googlemail.com> Cc: Polytropon <freebsd@edvax.de>, freebsd-questions@freebsd.org Subject: Re: backticks in rc.conf Message-ID: <87eisauv3c.fsf@kobe.laptop> In-Reply-To: <d36406630907210424p3e9e77c8tf12ab26da0573c89@mail.gmail.com> (chris scott's message of "Tue, 21 Jul 2009 12:24:09 %2B0100") References: <d36406630907210146m4e84c7dbpd55776168a50090c@mail.gmail.com> <20090721112920.c174849b.freebsd@edvax.de> <87ljmi1dyq.fsf@kobe.laptop> <d36406630907210424p3e9e77c8tf12ab26da0573c89@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 21 Jul 2009 12:24:09 +0100, chris scott <kraduk@googlemail.com> wrote:
>
> a=`echo $ifconfig_bge0 | /usr/bin/awk '{ for ( i=1 ; i <= NF; i++) { if ( $i
> ~ /[iI][nN][eE][tT]/ ) { sub(/\/.*/,"", $(i+1)); print $(i+1) } } }'`
> rsyncd_flags="--config=/etc/rsyncd.conf --address=$a"
This is far too complex for my taste. If you are certain that you will
have all the tools around (/usr /usr/local and so on), then it may be
simpler to use something like:
addr=$( ifconfig lagg0 | perl -ne 'print "$1\n" if (m/^.*inet\s+(\S+)\s.*$/);' )
This seems to work without all the looping/sub in awk:
$ ifconfig lagg0 | perl -ne 'print "$1\n" if (m/^.*inet\s+(\S+)\s.*$/);'
192.168.1.3
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?87eisauv3c.fsf>
