help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-bash] A do nothing function


From: Greg Wooledge
Subject: Re: [Help-bash] A do nothing function
Date: Fri, 28 Sep 2012 08:13:56 -0400
User-agent: Mutt/1.4.2.3i

On Thu, Sep 27, 2012 at 03:35:51PM -0600, Bob Proulx wrote:
>   filter=cat
>   if [ -f tun0.net ]; then
>     filter="sed /^eth/d;/^wlan/d;/^NetworkManager/d"
>   fi
>   RSLVCNFFILES="$(/lib/resolvconf/list-records | $filter | sed -e '/^lo$/d' 
> -e '/^lo[.]/d')"

Using a function would be more flexible, and less likely to break:

filter() { cat; }
if [ -f tun0.net ]; then
  filter() { sed /^eth/d;/^wlan/d;/^NetworkManager/d; }
fi
RSLVCNFFILES="$(/lib/resolvconf/list-records | filter | ...)"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]