From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24366 invoked by alias); 5 Nov 2012 15:12:16 -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: 17377 Received: (qmail 22296 invoked from network); 5 Nov 2012 15:12:14 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at benizi.com designates 64.130.10.15 as permitted sender) Date: Mon, 5 Nov 2012 10:03:46 -0500 (EST) From: "Benjamin R. Haskell" To: shawn wilson cc: Zsh Users Subject: Re: pipe every command In-Reply-To: Message-ID: References: User-Agent: Alpine 2.01 (LNX 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Mon, 5 Nov 2012, shawn wilson wrote: > is there a way to put every command through a pipe or redirect? > > i'd prefer some way that i can put logic in so that i can exclude some > commands. but, basically i want everything to go through > 'source-highlight' so: > ps ax | grep ssh > will end up: > ps ax | grep ssh | source-highlight -f esc256 -s shell > > and: > sa > would end up: > sa | source-highlight -f esc256 -s shell There might be a way to do this in the way you're talking about, but I accomplish a similar goal (being able to easily pipe things through `less`) using global aliases: alias -g L='| less' You could use: # H = highlight alias -g H='| source-highlight -f esc256 -s shell' Then to use it, the following examples would expand into your example commands: ps ax | grep ssh H or: sa H > sa doesn't look as nice as ps with this option, but hopefully i'll be > able to determine what command was given and have some logic to give > different options or none at all (for interactive commands like vim or > tmux, this might not be so good - it fails hard with vim anyway). Not very surprising -- Tmux and Vim require pretty full control of terminal I/O, so piping either one through a command won't do anything useful. -- Best, Ben