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

Note the position of the background & character:

test.sh >> log_file 2>&1 &
  • Thanks a lot , i completely ignored the position . Now it works – robotTech Apr 5 '16 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.