help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Is there any practical difference between { } & and ( ) &?


From: Peng Yu
Subject: [Help-bash] Is there any practical difference between { } & and ( ) &?
Date: Wed, 28 Nov 2018 10:01:27 -0600

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


-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]