Matt Riben wrote:

> hi i have a question, say i have two xterm windows open (this isnt limited
> to xterms, but im in x now so, bare with me...) i do the following in
> each...
> 
> [8:24am]matter:comet>ls -al `tty`
> crwx-w----   1 matter   tty        3,  14 Apr 29 08:25 /dev/ttype
> 
> ...
> 
> [8:24am]matter:comet>ls -al `tty`
> crwx-w----   1 matter   tty        3,  13 Apr 29 08:25 /dev/ttypd
> 
> my question is this, i own both tty's is it possible (an example would be
> great) to read/write one from the other ? actually writing to it (stdout) 
> isnt difficult at all (echo "hi" > /dev/ttyx), but how can read stdin, or
> possibly read stdout, and write stdin... ? 

What exactly are you trying to do?

Trying to read from the tty is prone to failure, because whatever
process you are running will also be reading from the tty, so you'll
just end up with the input being randomly distributed between multiple 
processes.

If you stop one of the processes from reading, e.g. by running `sleep 10000'
in one of the shells, then another program reading from the same tty
(e.g. `cat /dev/ttype') will get all of the input.

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to