1

I have to run a script background and also i have to catch the STDERR and STDOUT . i'm using the below line .

test.sh & >> log_file 2>&1

But un fortunately nothing is getting written to log_file

Please help me here

2 Answers 2

3

Note the position of the background & character:

test.sh >> log_file 2>&1 &
1
  • Thanks a lot , i completely ignored the position . Now it works
    – robotTech
    Commented Apr 5, 2016 at 11:21
0

This works

( echo stdout; echo >&2 stderr )& >> log 2>&1;
sleep 0.1; echo LOG:; cat log

and shows that both stdout and stderr get to the log.

The error must be somewhere in your test.sh.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .