enclose one or more commands inside a pair of parentheses


$ls
1
$( ls date )
ls: cannot access date: No such file or directory
$( `ls` date )
bash: 1: command not found
$cat 1
B$
$( ls `date` )
ls: cannot access Mon: No such file or directory
ls: cannot access Feb: No such file or directory
ls: cannot access 22: No such file or directory
ls: cannot access 21:36:34: No such file or directory
ls: cannot access IST: No such file or directory
ls: cannot access 2016: No such file or directory
$( `ls` `date` )
bash: 1: command not found
$( ls time )
ls: cannot access time: No such file or directory
$( ls `time` )

real	0m0.000s
user	0m0.000s
sys	0m0.000s
1
$( ls pwd )
ls: cannot access pwd: No such file or directory
$ls pwd
ls: cannot access pwd: No such file or directory
$( ls ) ( pwd )
bash: syntax error near unexpected token `('
$ls date
ls: cannot access date: No such file or directory
$`ls` date
bash: 1: command not found
$ls `date`
ls: cannot access Mon: No such file or directory
ls: cannot access Feb: No such file or directory
ls: cannot access 22: No such file or directory
ls: cannot access 21:41:17: No such file or directory
ls: cannot access IST: No such file or directory
ls: cannot access 2016: No such file or directory
$ (ls  pwd )
ls: cannot access pwd: No such file or directory
$x =1
bash: x: command not found
$x = 1
bash: x: command not found
$$x = 1
bash: =: command not found
$ (x = 1)
bash: x: command not found
$x=1
$echo $x
1
$(echo $x)
1
$echo $x
1
$(x=2;echo $x)
2
$echo $x
1
$(x=2 echo $x)
1
$echo $x
1
$(x=2;echo $x)
2
$


http://www.tldp.org/LDP/abs/html/subshells.html
http://unix.stackexchange.com/questions/138463/do-parentheses-really-put-the-command-in-a-subshell

%d bloggers like this: