From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18601 invoked by alias); 3 Oct 2014 02:29:03 -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: 19204 Received: (qmail 13339 invoked from network); 3 Oct 2014 02:29:02 -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,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <141002192910.ZM13761@torch.brasslantern.com> Date: Thu, 02 Oct 2014 19:29:10 -0700 In-reply-to: <1412259225.3798.0@numa-i> Comments: In reply to Helmut Jarausch "piping question" (Oct 2, 4:13pm) References: <1412259225.3798.0@numa-i> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: piping question MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Oct 2, 4:13pm, Helmut Jarausch wrote: } } Now I'd like to write a shell script 'xmost' which } should do the same as 'most' but with its output sent to a newly } generated xterm. xterm is going to reset the stdin/stdout of whatever command it runs to be the terminal input/output, so you can't pipe directly into a command that's running under xterm. So the trick is that you have to capture the output in a file and pass the file's name to the command running in the xterm. Zsh will automatically create an appropriate file name for you by using the process substitution syntax. So try something like this: xmost() { () { xterm -g 180x30+0+0 -hold -e "most < $1" } <(cat) } If you don't have a recent zsh with anonymous functions, you'll need a helper function of some kind to capture the file name created by <(cat) and pass it through to xterm.