From: Jeremy on 22 Apr 2010 13:43 Hi, From the shell, I want to allocate a new pseudoterminal using a named pipe for its stdin and stdout. Is this possible? I've looked for a program that will do this, but I'm coming up short. screen will not do exactly what I want, from what I can tell. My end goal is that I have several ptys open, and I'm getting labeled output from each of them in my main terminal: ~$ mkfifo mypipe1 ~$ mkfifo mypipe2 ~$ # the following would create the pty using mypipe1 for I/O ~$ some_magic_command mypipe1 ~$ some_magic_command mypipe2 ~$ # the following sends input to the pty to execute a command there ~$ echo 'someprogramwithoutput > ' >> mypipe1 ~$ ~$ echo 'someprogramwithoutput > ' >> mypipe2 ~$ # the following will monitor both pipes and give labeled output ~$ tail -f mypipe1 -f mypipe2 ==> mypipe1 <== some output from mypipe1's pty ==> mypipe2 <== some output from mypipe2's pty some more output from mypipe2's pty ==> mypipe1 <== some more output from mypipe1's pty And so forth. Is there a utility that will allow me to do this? Can the 'some_magic_command' be filled in with a real command? Thanks, Jeremy
From: Jeremy on 22 Apr 2010 13:49 On 4/22/2010 10:43 AM, Jeremy wrote: > <snip> > ~$ mkfifo mypipe1 > ~$ mkfifo mypipe2 > <snip> Correction: I just realized I would probably need two pipes for each pty (one for stdin and one for stdout).
From: Sidney Lambe on 22 Apr 2010 15:12 On comp.unix.shell, Jeremy <jeremy(a)pinacol.com> wrote: > Hi, > > From the shell, I want to allocate a new pseudoterminal using a named > pipe for its stdin and stdout. Is this possible? I've looked for a > program that will do this, but I'm coming up short. screen will not do > exactly what I want, from what I can tell. > > My end goal is that I have several ptys open, and I'm getting labeled > output from each of them in my main terminal: > > ~$ mkfifo mypipe1 > ~$ mkfifo mypipe2 > ~$ # the following would create the pty using mypipe1 for I/O > ~$ some_magic_command mypipe1 > ~$ some_magic_command mypipe2 > ~$ # the following sends input to the pty to execute a command there > ~$ echo 'someprogramwithoutput > > ' >> mypipe1 > ~$ > ~$ echo 'someprogramwithoutput > > ' >> mypipe2 > ~$ # the following will monitor both pipes and give labeled output > ~$ tail -f mypipe1 -f mypipe2 >==> mypipe1 <== > some output from mypipe1's pty > >==> mypipe2 <== > some output from mypipe2's pty > some more output from mypipe2's pty > >==> mypipe1 <== > some more output from mypipe1's pty > > > And so forth. Is there a utility that will allow me to do this? Can > the 'some_magic_command' be filled in with a real command? > > Thanks, > Jeremy I don't believe you can do that, nor is it necessary. What you _can_ do is create a new pty that runs a command/script when created, or you can direct the output of commands/scripts to an existing pty: ls -l > /dev/pts/4 echo -e "\n\n`ls -l`" > /dev/pts/4 Sid
From: Jonathan de Boyne Pollard on 23 Apr 2010 02:13 > > > From the shell, I want to allocate a new pseudoterminal using a named > pipe for its stdin and stdout. Is this possible? > Yes. One set of tools that have been around for years for this are the tools in the ptyget package. http://code.dogmap.org/ptyget/
|
Pages: 1 Prev: Question using sed replace text file \t Next: anchor for next position in regular expression |