[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bourne Shell help



On Fri, Mar 19, 2004 at 02:37:00PM -0500, Paul Galbraith wrote:
> I think this should be an easy question, but after some effort I still 
> haven't found an answer, and am really curious now!
> 
> I wanted to run a compile in the background (in a bourne shell) and dump 
> stderr and stdout to a file....should be simple enough, but obviously I 
> don't spend enough time in 'sh' to know the answer.  I tried this:
> 
>       nice make build > /root/XF4-make.out 2>&1 &
> 
> and it doesn't work quite right.  If I drop the final '&', the command 

Does it work without "nice"?  Maybe there is some weird interaction of
the stdout/stderr of the nice and make commands.  Maybe try:
       (nice make build ) > /root/XF4-make.out 2>&1 &

which should run everything in () in a sub-shell, thus only 1 stdout/err
stream to work with.  You did say "bourne" shell, and I guess I'm more
familiar with "bash", but I think this is still okay.

> runs fine in the foreground, and dumps stdout and stderr to the file, so 
> that part of things seems ok.  It's just getting it to run in the 
> background that has stumped me.  I wrote a one liner script to do the 
> job...but it's still really bugging me, can anyone tell me how to do it 
> from the command line? 
> 
> Cheers!
> 
> Paul

-- 

Chris Harris <charris@rtcmarketing.com>
-------------------------------------------
GNU/Linux --- The best things in life are free.



Reply to: