0
我有一個csh
腳本(a.csh
),它調用另一個(./b.csh
)。如果在運行b.csh
時某些條件不滿意,我如何從a.csh
退出?如何在csh中退出調用腳本?
這裏是我叫b.csh
b.csh >&! b.csh.log
沒有爲bash
How to exit all the calling scripts in bash?一個相關的問題。
我有一個csh
腳本(a.csh
),它調用另一個(./b.csh
)。如果在運行b.csh
時某些條件不滿意,我如何從a.csh
退出?如何在csh中退出調用腳本?
這裏是我叫b.csh
b.csh >&! b.csh.log
沒有爲bash
How to exit all the calling scripts in bash?一個相關的問題。
內b.csh
,以此來終止a.csh
而不終止b.csh
:
set PPID = `ps -ef | awk -v pid="$$" '{if ($2 == pid) {print $3}}'`
kill $PPID
在bash類似的炮彈,$PPID
定義,但對於CSH我們必須手動解壓。
$$
返回當前進程ID(pid)(也就是b.csh
的pid)。