Re: Capturing file descriptor 3, or alternatives.

2012-07-04 Thread Ben Scott
I just realized I replied privately and not to the list on the below. D'oh! -- Forwarded message -- From: Ben Scott Date: Sun, Jun 24, 2012 at 9:49 PM Subject: Re: Capturing file descriptor 3, or alternatives. To: Bill Freeman On Tue, Jun 19, 2012 at 4:34 PM, Bill Fr

Re: Capturing file descriptor 3, or alternatives.

2012-06-26 Thread Ben Scott
On Tue, Jun 26, 2012 at 11:51 AM, Bill Freeman wrote: > But I have to provide two different values, for four different > environment variables to get the job done.  I was thinking about how > to pack two values into one table (displayed in the menu), and doing > the splitting of stuff in bash ...

Re: Capturing file descriptor 3, or alternatives.

2012-06-26 Thread Bill Freeman
It seems as though Ben has a good approach (in the separate thread). But to follow up on questions from others, let me be a bit more detailed about the problem setting: We deploy python based web-sites and web applications (Django, Twisted or -- shudder --Plone) to various *nix servers. Could be

Re: SOLVED: Capturing file descriptor 3, or alternatives.

2012-06-26 Thread Bill Freeman
On Tue, Jun 26, 2012 at 8:01 AM, Ben Scott wrote: > P.S. to the P.P.P.S.: > > On Tue, Jun 26, 2012 at 7:55 AM, Ben Scott wrote: >>  I kept trying this one-liner: >> >> ANSWER=$( ( dialog --output-fd 3 --inputbox 'Speak Friend and enter' 0 >> 0  > /dev/fd/4 ) 3>&1 4>&1 ) > >  This may make the red

Re: SOLVED: Capturing file descriptor 3, or alternatives.

2012-06-26 Thread Ben Scott
P.S. to the P.P.P.S.: On Tue, Jun 26, 2012 at 7:55 AM, Ben Scott wrote: >  I kept trying this one-liner: > > ANSWER=$( ( dialog --output-fd 3 --inputbox 'Speak Friend and enter' 0 > 0  > /dev/fd/4 ) 3>&1 4>&1 ) This may make the redirection I'm talking about clearer: ANSWER=$( ( dialog --outp

Re: SOLVED: Capturing file descriptor 3, or alternatives.

2012-06-26 Thread Ben Scott
P.P.P.S.: On Tue, Jun 26, 2012 at 7:36 AM, Ben Scott wrote: > http://pastebin.com/XdxWjpeU Ah-ha! I think I just figured out why I need the exec builtin. I kept trying this one-liner: ANSWER=$( ( dialog --output-fd 3 --inputbox 'Speak Friend and enter' 0 0 > /dev/fd/4 ) 3>&1 4>&1 ) Th

Re: SOLVED: Capturing file descriptor 3, or alternatives.

2012-06-26 Thread Ben Scott
On Mon, Jun 25, 2012 at 11:09 PM, Ben Scott wrote: > On Tue, Jun 19, 2012 at 4:34 PM, Bill Freeman wrote: >> What occurred to me is to send the final result to fd 3, which the >> shell would have to have opened before forking. ... > > http://pastebin.com/RGBuRw0e > It appears to work. P.P.S.:

Re: SOLVED: Capturing file descriptor 3, or alternatives.

2012-06-26 Thread Ben Scott
On Mon, Jun 25, 2012 at 11:09 PM, Ben Scott wrote: >> What occurred to me is to send the final result to fd 3, which the >> shell would have to have opened before forking. ... > > http://pastebin.com/RGBuRw0e P.S.: CAVEAT I should prolly make it explicit that I don't understand everything abo

SOLVED: Capturing file descriptor 3, or alternatives.

2012-06-25 Thread Ben Scott
On Tue, Jun 19, 2012 at 4:34 PM, Bill Freeman 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 i

Re: Capturing file descriptor 3, or alternatives.

2012-06-25 Thread Joshua Judson Rosen
Ben Scott writes: > > On Mon, Jun 25, 2012 at 9:13 AM, Kevin D. Clark > wrote: > > I think that a lot of effort could be put into solving this problem > > with these constraints...or...the problem could be solved simply with > > a small temporary file that parent+child agreed to use. > ... > > I'

Re: Capturing file descriptor 3, or alternatives.

2012-06-25 Thread Ben Scott
On Mon, Jun 25, 2012 at 9:13 AM, Kevin D. Clark wrote: > I think that a lot of effort could be put into solving this problem > with these constraints...or...the problem could be solved simply with > a small temporary file that parent+child agreed to use. ... > I'm a big fan of "simple". I am, t

Re: Capturing file descriptor 3, or alternatives.

2012-06-25 Thread Kevin D. Clark
I've thought about this problem during my commute for a week now, and I haven't been able to come up with a simple solution that satisfies the constraints. I think that a lot of effort could be put into solving this problem with these constraints...or...the problem could be solved simply with a s

Re: Capturing file descriptor 3, or alternatives.

2012-06-24 Thread Ben Scott
On Thu, Jun 21, 2012 at 5:20 PM, Bill Freeman wrote: >> I was suggesting the possibility that an existing tool might >> help you by somehow interacting with the user via some channel >>> other than stdout and then uttering the results back to the >>> parent shell via stdout, > > Ah, well, there is

Re: Capturing file descriptor 3, or alternatives.

2012-06-23 Thread Joshua Judson Rosen
Bill Freeman writes: > > I'm not following. Perhaps I just don't understand process > substitution. Just in case I'm being misheard, let me try again. Yeah, I think I didn't understand exactly what you wanted to do. So..., what you want is for the parent shell to end up just making a call to p

Re: Capturing file descriptor 3, or alternatives.

2012-06-21 Thread Bill Freeman
On Thu, Jun 21, 2012 at 8:43 AM, Michael ODonnell wrote: > > >> What I haven't figured out is how to return the results to the >> parent shell.  Not because I can't write it somewhere other >> than the tty, but because I don't know how to get the shell to >> hook up a pipe to that extra fd, to whi

Re: Capturing file descriptor 3, or alternatives.

2012-06-21 Thread Michael ODonnell
> What I haven't figured out is how to return the results to the > parent shell. Not because I can't write it somewhere other > than the tty, but because I don't know how to get the shell to > hook up a pipe to that extra fd, to which I can write, and from > which the shell can later read (while

Re: Capturing file descriptor 3, or alternatives.

2012-06-20 Thread Bill Freeman
The several of these I've looked into (duck-duck-go is having a hard time finding some of them) solve a problem that I don't have, writing the UI. Some are inappropriate even for that, since they must interface using the tty that their parent process (shell) is using, not some X server not availab

Re: Capturing file descriptor 3, or alternatives.

2012-06-20 Thread Bill Freeman
Whiptail. Is that a Harry Potter character? On Tue, Jun 19, 2012 at 4:47 PM, Michael ODonnell wrote: > > > Is something like whiptail ruled out? > > ___ > gnhlug-discuss mailing list > gnhlug-discuss@mail.gnhlug.org > http://mail.gnhlug.org/mailman/lis

Re: Capturing file descriptor 3, or alternatives.

2012-06-19 Thread Michael ODonnell
Here is a more complete list of candidates some of which may handle the fd gymnastics in question for you and then simply utter the desired results on their stdout: Python: python-dialog - Python module for making Text/Console-mode user interfaces Text: dialog- Displays user-friendly

Re: Capturing file descriptor 3, or alternatives.

2012-06-19 Thread Joshua Judson Rosen
Two thoughts: * Use Bash's `process substitution' syntax: "<(...)" and/or ">(...)" to pass the auxiliary process' stdin and/or stdout fd as an argument. If you don't want to have two script-files rather than one, then you may have to do something like...: bash -c '

Re: Capturing file descriptor 3, or alternatives.

2012-06-19 Thread Michael ODonnell
Is something like whiptail ruled out? ___ gnhlug-discuss mailing list gnhlug-discuss@mail.gnhlug.org http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss/

Capturing file descriptor 3, or alternatives.

2012-06-19 Thread Bill Freeman
I really hate string processing in bash. So I'd like to write a script in another language that 1. interacts with the user; 2. calculates the desired values of some environment variables; and 3. communicates those settings to the shell from which it was invoked (since the environment variables are