From owner-freebsd-questions@FreeBSD.ORG Tue Jul 21 11:46:38 2009 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 006A7106564A for ; Tue, 21 Jul 2009 11:46:37 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from igloo.linux.gr (igloo.linux.gr [62.1.205.36]) by mx1.freebsd.org (Postfix) with ESMTP id 48D628FC16 for ; Tue, 21 Jul 2009 11:46:36 +0000 (UTC) (envelope-from keramida@freebsd.org) Received: from kobe.laptop (adsl126-163.kln.forthnet.gr [77.49.245.163]) (authenticated bits=128) by igloo.linux.gr (8.14.3/8.14.3/Debian-9) with ESMTP id n6LBZrYm015057 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Tue, 21 Jul 2009 14:35:59 +0300 Received: from kobe.laptop (kobe.laptop [127.0.0.1]) by kobe.laptop (8.14.3/8.14.3) with ESMTP id n6LBZqGo063317 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 21 Jul 2009 14:35:53 +0300 (EEST) (envelope-from keramida@freebsd.org) Received: (from keramida@localhost) by kobe.laptop (8.14.3/8.14.3/Submit) id n6LBZq3i063316; Tue, 21 Jul 2009 14:35:52 +0300 (EEST) (envelope-from keramida@freebsd.org) From: Giorgos Keramidas To: chris scott References: <20090721112920.c174849b.freebsd@edvax.de> <87ljmi1dyq.fsf@kobe.laptop> Date: Tue, 21 Jul 2009 14:35:51 +0300 In-Reply-To: (chris scott's message of "Tue, 21 Jul 2009 12:24:09 +0100") Message-ID: <87eisauv3c.fsf@kobe.laptop> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (berkeley-unix) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Hellug-MailScanner-ID: n6LBZrYm015057 X-Hellug-MailScanner: Found to be clean X-Hellug-MailScanner-SpamCheck: not spam, SpamAssassin (not cached, score=-4.448, required 5, autolearn=not spam, ALL_TRUSTED -1.80, AWL -0.05, BAYES_00 -2.60) X-Hellug-MailScanner-From: keramida@freebsd.org X-Spam-Status: No Cc: Polytropon , freebsd-questions@freebsd.org Subject: Re: backticks in rc.conf X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Jul 2009 11:46:38 -0000 On Tue, 21 Jul 2009 12:24:09 +0100, chris scott 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