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: Stephane Chazelas
Subject: Re: [Help-bash] A do nothing function
Date: Fri, 28 Sep 2012 23:02:52 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

2012-09-28 11:23:41 -0400, DJ Mills:
[...]
> filter() {
>   if [ -f tun0.net ]; then
>     sed '/^eth/d; /^wlan:/d; /^NetworkManager/d'
>   else
>     cat
>   fi
> }
> 
> blah=$(foo | filter | ....)
[...]

Onother approach that saves the "cat":

post_filter() {
  if [ -f tun0.net ]; then
    "$@" | sed '...'
  else
    "$@"
  fi
}

blah=$(post_filter foo | ...)

-- 
Stephane




reply via email to

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