3 ms·
Definitely missing one & after the git clone, else the cd into the directory after will fail, assuming the git clone takes non-zero time to execute.
by ukuina 4y ago
Definitely missing one & after the git clone, else the cd into the directory after will fail, assuming the git clone takes non-zero time to execute.
- philsnow 4y agoyeah that one should definitely be more like { git clone ... ; cd "$1"; ./configure; make; make install } & to run the group command (I had to look up the term in man bash) all in the background. Using group commands can be kind of weird though because they're run in the environment of the running shell, so % mkdir -p /tmp/foo && cd /tmp/foo && pwd /tmp/foo % { mkdir bar; cd bar; echo $BASH_SUBSHELL ; } 0 % pwd /tmp/foo/bar but if you do the group command in the background, bash runs it in a subshell[0] and the current directory for your shell doesn't change: % mkdir -p /tmp/foo && cd /tmp/foo && pwd /tmp/foo % { mkdir bar; cd bar; echo $BASH_SUBSHELL ; } & 1 % pwd /tmp/foo [0] From man bash: If a command is terminated by the control operator &, the shell executes the command in the background in a subshell.