Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: piping question
- X-seq: zsh-users 19207
- From: Kurtis Rader <krader@xxxxxxxxxxxxx>
- To: Helmut Jarausch <jarausch@xxxxxxxxxxxxxxxxxxx>
- Subject: Re: piping question
- Date: Fri, 3 Oct 2014 06:36:40 -0700
- Cc: Zsh Users <zsh-users@xxxxxxx>
- In-reply-to: <1412259225.3798.0@numa-i>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <1412259225.3798.0@numa-i>
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@xxxxxxxxxxxxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author