Suppose myprogram is spawned through the terminal (bash) and gets pid of 1234 (different everytime).
I want to redirect, both stdout and stderr, to a tempfile named abc-$PID (if the PID is 1234, use tempfile abc-1234.
The code looks like this now:
myprogram > /tmp/abc-$! 2>&1
it doesn't work
Please help.