I have read that $coproc < command >
is different from $< command > &
in that coproc
will execute command
in a sub-shell process.
But when I tested it, it worked just like $< command > &
. The test is as follow:
First: test the behavior of $< command > &
.
- Run
$nano &
on tty1 - On another tty, output from
$ps -t tty1 --forest
indicates nano process is child process of the -bash process (login bash shell process -> no sub-shell process was created)
Second: test the behavior of $coproc < command >
- Run
$coproc nano
on tty1 - On another tty, output from
$ps -t tty1 --forest
is the same as above (no sub-shell process was created)
So is $coproc < command >
simply the same as $< command > &
?
The shell used was a bash shell
coproc
and `&' in bash isn't the creation of a sub-shell process? – Tran Triet Oct 02 '18 at 07:24