On Mon, Sep 13, 1999 at 08:18:30PM -0500, Gregory T. Norris wrote: > This isn't really a Debian issue as such, but I thought that someone > here might be able to point me in the right direction... Hope I'm not > too far off base here :-) > > I've got a shell script that I want to have log it's actions on a > selective basis (dependent upon run-time settings). I know it could > re-exec itself with appropriate redirection, but I don't want to rely on > commandline parameters or environment settings which might inadvertently > be set. Is there any way for a shell script to determine where it's > stdout/stderr is going, and to redirect it "from this point on"? > Preferably something which works with a generic /bin/sh, rather than > specific to bash, but I'll work with whatever I can get... > > Thanx! >
Not sure if I understood your question. Anyway, if you want to redirect a particular file in a shell you don't have to know where it's been directed to at a certain point. For example, you can do something like this: exec 1>log 2>log.err ... do something (everything going to stdin is been redired to file "log" and stderr to "log.err") ... exec 1>log.a 2>log.a.err ... I hope this helps. Dejan -- Dejan Muhamedagic UNIX and Linux Support Quant-X Service & Ph: (+43) 4212 90555-0 Consulting Ges.m.b.H. Fax: (+43) 4212 90555-20 http://www.quant-x.com Email: [EMAIL PROTECTED]