Peng Yu
2018-11-28 16:01:27 UTC
Hi,
Both { } & and ( ) & start a new bash process. In this sense, do they
have any differences (other than some trivial syntax requirements like
{ } & should include the ";")? Thanks.
$ cat ./main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
set -v
{ echo "{$BASHPID"; } &
( echo "($BASHPID" ) &
echo "$BASHPID"
wait
$ ./main.sh
{ echo "{$BASHPID"; } &
( echo "($BASHPID" ) &
echo "$BASHPID"
23876
wait
(23878
{23877
Both { } & and ( ) & start a new bash process. In this sense, do they
have any differences (other than some trivial syntax requirements like
{ } & should include the ";")? Thanks.
$ cat ./main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:
set -v
{ echo "{$BASHPID"; } &
( echo "($BASHPID" ) &
echo "$BASHPID"
wait
$ ./main.sh
{ echo "{$BASHPID"; } &
( echo "($BASHPID" ) &
echo "$BASHPID"
23876
wait
(23878
{23877
--
Regards,
Peng
Regards,
Peng