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

Re: Bourne Shell help



On Friday 19 March 2004 12:37, 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

Works here.  What do you mean it doesn't work quite right?  What is your 
output?

> 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

You could also try this:
$ nice make build &>/root/XF4-make.out &

The bash man page says it's the same as what you entered, so it should work, 
but since your posted construct should as well, I'm not so sure.

Alternately, you could use job control.  Run the command without the last 
'&', then press ^Z, then bg.  

HTH.

Justin Guerin



Reply to: