zsh-users
 help / color / mirror / code / Atom feed
From: Kurtis Rader <krader@skepticism.us>
To: Helmut Jarausch <jarausch@igpm.rwth-aachen.de>
Cc: Zsh Users <zsh-users@zsh.org>
Subject: Re: piping question
Date: Fri, 3 Oct 2014 06:36:40 -0700	[thread overview]
Message-ID: <CABx2=D-bfgPcg3AEVJ6cMq6O-Rhn0PSk8ebNVbNWdGA5o48PKw@mail.gmail.com> (raw)
In-Reply-To: <1412259225.3798.0@numa-i>

[-- Attachment #1: Type: text/plain, Size: 1203 bytes --]

As Bart pointed out xterm is going to establish a new pty via the getpty(),
posix_openpt() or equivalent API. It then attaches stdin, stdout, stderr to
that pty before launching the shell or command specified by the -e option.
By design there is no way to coerce xterm to act like a pipeline filter.

In addition to Bart's suggestion you can leverage the /proc filesystem if
you're doing this on Linux, *BSD, or other UNIX implementation that
provides it. Your xmost script can examine /proc/$$/fd/0. If it isn't
associated with a pty it can arrange for it to be the stdin of the command
running in the new xterm. Specifics are left as an exercise for the student.

On Thu, Oct 2, 2014 at 7:13 AM, Helmut Jarausch <
jarausch@igpm.rwth-aachen.de> wrote:

> Hi,
>
> I have a command 'most' which is similar to 'less'.
> 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.
>
> If I say
>
> xterm -g 180x30+0+0  -hold -e most
>
> I cannot pipe into it anymore, like
>
> ls -l | xmost
>
> Can this be achieved?
>
> Many thanks for a hint,
> Helmt.
>



-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

  parent reply	other threads:[~2014-10-03 13:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-02 14:13 Helmut Jarausch
2014-10-03  2:29 ` Bart Schaefer
     [not found]   ` <1412326536.9490.1@numa-i>
2014-10-03 15:04     ` Bart Schaefer
2014-10-03 13:36 ` Kurtis Rader [this message]
2014-10-03 14:42 ` Mikael Magnusson
2014-10-03 15:23   ` Bart Schaefer
2014-10-03 15:42     ` Bart Schaefer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CABx2=D-bfgPcg3AEVJ6cMq6O-Rhn0PSk8ebNVbNWdGA5o48PKw@mail.gmail.com' \
    --to=krader@skepticism.us \
    --cc=jarausch@igpm.rwth-aachen.de \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).