It\'s fairly simple to log both the stdout and the stderr of a command to a log file:
./foo.sh &> log.txt
The problem is that when i
maybe you are looking for script
it records both stdout, stderr and the commands...it starts a new shell in which it records everything (or use -c _cmd_
)
$ script tx1
your color()
function breaks order because sed
is buffering...
How about redirecting stderr to ./tmperr and stdout to ./tmpout, now run two scripts in the background that each continuously read a single line from tmperr or tmpout and then remove that line? This is obviously less than ideal, but if there is a decent delay in the actual foo.sh script, this should work out.