Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Nov 2004 11:06:56 -0600
From:      Adam Fabian <afabian@austin.rr.com>
To:        freebsd-questions@freebsd.org
Subject:   Re: shell programming challenge
Message-ID:  <20041126170656.GB93504@turingmachine.mentalsiege.net>
In-Reply-To: <41A7568F.3000906@Silver-Lynx.com>
References:  <41A615CE.6010405@Silver-Lynx.com> <19861fba0411251005265ecb91@mail.gmail.com> <41A62A68.8050201@Silver-Lynx.com> <Pine.GSO.4.61.0411260916060.22302@mail.ilrt.bris.ac.uk> <41A7568F.3000906@Silver-Lynx.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Nov 26, 2004 at 09:15:11AM -0700, Don Wilde wrote:
> 
> >
> >If you have the option to modify it, ensure that your script exits via 
> >"exec sh". Alternatively a wrapper that does this is straightforward to 
> >build.
> >
> It's looking more and more that I need to make a temporary file that 
> packages both the init file and the program command line (eval 
> "blah...") before running. These will not be just shell scripts, they 
> will be tool programs and x applications. Didn't want to do that because 
> of the risk of leaving junk in /tmp.

It's really socially-acceptable to leave junk in /tmp.  /tmp is a
volatile dumping ground with no guarantee of file suvival for any
length of time, that may even be cleaned on reboot.

I played with this for a while, and I have a suspicion that maybe you
could use /dev/fd/3 and start bash with something like --rc-file
/dev/fd/3 and not close tha standard input, but it's not possible, or
I couldn't quite pull it off.  (I suspect the latter.)

The only other option I can think of involves a temporary file of
sorts, too.  You could use a FIFO, and then the contents of the
"temporary file" wouldn't be left on the disk, but you'd still have
the FIFO to deal with.

You may also be trying to do something complex enough that it's just
more trouble than it's worth to do it with shell programming.

Anyway, good luck.

-- 
Adam Fabian (afabian@austin.rr.com)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20041126170656.GB93504>