开发者

What starts new subshell in Bash?

开发者 https://www.devze.com 2023-03-18 09:41 出处:网络
A开发者_如何学运维re there actions in Bash other than pipes and command substitution that start a new subshell?Putting a command chain in parens (( ... )) also starts a new subshell.

A开发者_如何学运维re there actions in Bash other than pipes and command substitution that start a new subshell?


Putting a command chain in parens (( ... )) also starts a new subshell.

( cd /tmp ; pwd ) ; pwd


Each shell script running is, in effect, a subprocess (child process) of the parent shell.

A shell script can itself launch subprocesses. These subshells let the script do parallel processing, in effect executing multiple subtasks simultaneously.

say you have script test.sh. After you run it if you run the command

ps -ef|grep -i test.sh

you will see the it runs with different PID

In general, an external command in a script forks off a subprocess/subshell

0

精彩评论

暂无评论...
验证码 换一张
取 消