When I use
2> >(tee stderr.log >&2)
in a shell with sh-4.1$ prepending the command, it doesn’t work. However, if the beginning shows username@hostname, it works.
Also – this is while opening screen with PHP. How should I change my script for this to work?
The script is:
php exec("screen -S SCREENNAME -p 0 -X stuff 'COMMAND 2> >(tee stderr.log >&2)");
When your prompt has “sh” at the beginning, it’s bash running in sh compatibility mode, which does not have process substitution. Your command must be run via bash; run
bash -cand pass the command to run as a string.