I wrote two shell scripts a.sh
and b.sh
. In a.sh
and b.sh
I have a infinite for loop and they print some output to the te
Redirect the output to a file like this:
./a.sh > somefile 2>&1 &
This will redirect both stdout and stderr to the same file. If you want to redirect stdout and stderr to two different files use this:
./a.sh > stdoutfile 2> stderrfile &
You can use /dev/null
as one or both of the files if you don't care about the stdout and/or stderr.
See bash manpage for details about redirections.