Bash: tree direction in sub-shell working incorrec

2019-07-25 11:48发布

问题:

I tested this on a CentOS machine a while back and it worked nicely. Now on another machine, I try this and it fails to work. What is incorrect?

command 2> >(tee stderr.log >&2) && exit

I get this message back.

sh: syntax error near unexpected token `>'

Any suggestions?

回答1:

The answer is in the error message. The traditional Bourne shell (sh) doesn't support process substitution (e.g. >(command)). You weren't using Bash. You can change your default shell using the chsh command.



标签: bash stderr tee