I was trying to use a diff command for comparing directory listings which works fine in bash:
diff <(cd alpha ; find . -type f) <(cd beta; find . -type f)
However, on the ash (embedded device where no other shell is available) I get
-ash: syntax error: unexpected "("
Is there any difference regarding reading input operator <
or parentheses (
)
?
Don't confuse the angle bracket in
<( … )
with the one in redirections likecat < file
. In bash,<( echo hi )
is effectively a file with the contents "hi" (at least for reading purposes). So you can doYou can also do
And the shell actually expands that process substitution to a filename.
Process substitution is a bash feature. It is not part of the POSIX specification and does not exist in shells like ash. Redirection, on the other hand, is POSIX.