The following script results in error when called directly, but not when called with . ./test.sh:
% cat test.sh
echo "foo" |
tee >(rev)
% . ./process_subst_test.sh
foo
oof
% ./process_subst_test.sh
./process_subst_test.sh: line 1: syntax error near unexpected token (' ./process_subst_test.sh: line 1:echo "foo" | tee >(rev)'
% echo "foo" |
tee >(rev)
foo
oof
What is wrong about the process redirection syntax in the script?
Why results vary depending on how script is invoked?
My shell is:
% zsh --version
zsh 5.8.1 (x86_64-apple-darwin21.0)
zshshell will run scripts with no#!-line using theshshell. Theshshell does not understand>(...). See the duplicate question. – Kusalananda Aug 04 '22 at 14:51#!-line is for, and that it is calledshebang! – wass rubleff Aug 04 '22 at 21:15