jobs=() trap '((${#jobs[@]} == 0)) || kill ${jobs[*]} ; exit' EXIT HUP TERM INT subscript1 & jobs+=($!) subscript2 & jobs+=($!)
References :
zsh - Killing subprocesses after the script has finished or is killed - Unix & Linux Stack Exchange
沒有留言:
張貼留言