SOLVED: Capturing file descriptor 3, or alternatives.

Ben Scott dragonhawk at gmail.com
Mon Jun 25 23:09:51 EDT 2012


On Tue, Jun 19, 2012 at 4:34 PM, Bill Freeman <ke1g.nh at gmail.com> wrote:
> What occurred to me is to send the final result to fd 3, which the
> shell would have to have opened before forking. ... get bash(sh)
> to build a pipe (unnamed) to the child process's fd 3,
> and either exec that (when it comes) or stuff it in a shell variable
> (which I can then exec), all without redirecting stdin, stdout, or
> stderr for the child.

  *Jackpot*!  [bell ringing noise]

  Check this out:

http://pastebin.com/RGBuRw0e

  It appears to work.

  It seems to me that the exec should not be needed -- that we should
be able to set-up all the file descriptors using subshells and
redirection on one line.  But I can't quite figure out how/why to get
that to happen, and I need sleep.

-- Ben



More information about the gnhlug-discuss mailing list