0

In earlier times I was able to open a pair of pseudo terminals /dev/ttyp9 and /dev/ptyp9. It was easy to do something like:

$ cat /dev/ptyp9

and in another shell

$ echo Hallo > /dev/ttyp9

But on my linux ( fedora 40 ) there is no /dev/pty... anymore :-(

I found that there is something different with device files /dev/ptmx and /dev/pts

I was able to

$ cat /dev/ptmx

and

$ echo Hallo > /dev/pts0

which has the same effect as with the /dev/ttyp0 and /dev/ptyp0. But if I open /dev/ptmx again to get a second pair of ptys I have no idea what is the corresponding device name.

The man page tells me that I have to use ptsname(). But this requires to write a c program. I want to use ptys from shell.

Is there any chance to get a pair of ptys which can be used from a shell?

2
  • zsh has a zsh/zpty module for that. In other shells, you can use socat or perl (or possibly expect or script depending on what you want to do with those ptys). Commented Jan 21 at 10:21
  • 1
    Aside from "because you can", would you be able to explain what you are trying to achieve here? There may be better solutions Commented Jan 21 at 13:10

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.