bash - why does ( cd && sleep 5000 ) start second process -


i have script test.sh

#!/bin/bash ( cd . && sleep 5000 ) 

i execute ./test.sh & , run ps lax | grep test.sh

i have 2 processes running...

0  1000  6883  6600  20   0  10600  1332 -      s    pts/2      0:00 /bin/bash ./test.sh 1  1000  6884  6883  20   0  10604   704 -      s    pts/2      0:00 /bin/bash ./test.sh 
  • why have 2 processes running , second process come from?
  • why don't have 2 processes if remove cd ".." command?

thanks explanation, don't , think i'm lacking basics here... or vodoo? ;)

grouping series of bash commands inside parenthesis execute them in sub-shell.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -

c# - String.format() DateTime With Arabic culture -