Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: piping question



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