From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21888 invoked by alias); 3 Oct 2014 15:23:46 -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: 19212 Received: (qmail 28081 invoked from network); 3 Oct 2014 15:23:45 -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: <141003082330.ZM15100@torch.brasslantern.com> Date: Fri, 03 Oct 2014 08:23:30 -0700 In-reply-to: Comments: In reply to Mikael Magnusson "Re: piping question" (Oct 3, 4:42pm) References: <1412259225.3798.0@numa-i> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: Mikael Magnusson Subject: Re: piping question Cc: Zsh Users MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Oct 3, 4:42pm, Mikael Magnusson wrote: } } echo hi there | { xterm -e 'most <& 7' 7< <(cat) } I avoided that because I was concerned that some terminal emulators would close all the descriptors above 2 when launching the command. If it works, though, you can use the {varname}<& syntax to obtain a free descriptor, and then you don't need <(cat). xmost() { set - "${(qq)@}" # Requote command line arguments if [[ -t 0 ]] then xterm -g 180x30+0+0 -hold -e "most $*" else local stdin exec {stdin}<&0 xterm -g 180x30+0+0 -hold -e "most $* <&$stdin" fi } It's possible the [[ -t 0 ]] branch is extraneous with this trick, but it seems prudent not to have xmost reading from two different ttys.