From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 723 invoked by alias); 26 Oct 2015 13:36:07 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 20828 Received: (qmail 8161 invoked from network); 26 Oct 2015 13:36:04 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.0 X-Authority-Analysis: v=2.1 cv=X+5rdgje c=1 sm=1 tr=0 a=1C4gNTuzWsyXT6pUEgZwKw==:117 a=1C4gNTuzWsyXT6pUEgZwKw==:17 a=gH2l33NO9zgA:10 a=Fdkxr_5KmFUA:10 a=p5GCia9AZGT8M7tXR8UA:9 a=pvA44qeTxYYA:10 Message-id: <562E2C41.8040907@eastlink.ca> Date: Mon, 26 Oct 2015 06:36:01 -0700 From: Ray Andrews User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Icedove/31.7.0 MIME-version: 1.0 To: zsh-users@zsh.org Subject: Re: greps pipes and eval bad patterns References: <562D31C3.9030705@eastlink.ca> <151025180235.ZM30558@torch.brasslantern.com> <562D9E85.7080006@eastlink.ca> <1413271445864647@web24g.yandex.ru> In-reply-to: <1413271445864647@web24g.yandex.ru> Content-type: text/plain; charset=koi8-r; format=flowed Content-transfer-encoding: 7bit On 10/26/2015 06:04 AM, ZyX wrote: > Specifically this I would write as > > local -a gcmd > gcmd=( cat ) > if [[ $1 == ,f ]] ; then > gcmd=( grep '\[01;34m' ) > shift > endif > integer levels=$(( ($1 + 1) * 4 )) > tree --du -haC | grep -Ev '^[^\[]{'"$levels"'\[* ' | $gcmd That is better. The pipe shouldn't be in the variable. But because you can't have nothing on the right side of the pipe, I had been using ' grep .* ' as the default for '$gcmd' which seemed rather clumsy. Question: Why can't we have nothing on the right side? Why not just ignore the pipe in that case? It would obviate this situation. Logic being that a pipe to nowhere is a null command thus ignored. Or is there some other syntactic use for a pipe to nowhere?