Paul L. Snyder on 30 Jan 2009 09:21:30 -0800 |
On January 30, 2009 , "Matt Mossholder" <matt@mossholder.com> wrote: >----- "Bill East" <wm.east@gmail.com> wrote: > >To answer the idle curiosity part, yes, you can send input to the processes, without >bringing it back into the foreground (using fg as others have suggested). > >Off the top of my head, one way to do it would be to send data to /proc/<pid>/fd/0. >That sends data to file descriptor 0 of the process, which happens to be "standard >input". Very cool idea! Sadly, it doesn't look like it works. Since the grep process is forked from the shell, it uses the same pseudoterminal as the shell. When it was backgrounded, it would have suspended when it tried to read from its stdin. So, /proc/<pid/>/fd/0 is a symlink to some pty, /dev/pts/<num>, and if you check the fd symlinks for both the shell and the forked process, they are the same. If you direct data to it, it goes to the process that current has that pty open, which is the parent shell, and the text will show up unfiltered in the shell's stdout. Paul ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|