Explanation: with common shells (sh, bash, zsh at least), the chain
command
`echo cmd args | $SHELL` leaves an unnecessary shell process, waiting
for its
child process `cmd` to complete. Whereas `$SHELL -c "cmd args"` only
leaves one
process `cmd` in the system.
My guess is that, in the second case, the shell is able to see when
there is
only one command to execute, and in this case it saves a fork operation.
Whereas
in the first case, there might be subsequent pending commands to
process.
--
Glen Mével
Received on Sat Aug 10 2019 - 23:32:14 CEST