⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 trap.tests

📁 android-w.song.android.widget
💻 TESTS
字号:
# test the trap codetrap 'echo exiting' 0trap 'echo aborting' 1 2 3 6 15# make sure a user-specified subshell runs the exit trap, but does not# inherit the exit trap from a parent shell( trap 'echo subshell exit' 0; exit 0 )( exit 0 )trapfunc(){	trap 'echo ${FUNCNAME:-$0}[$LINENO] funcdebug' DEBUG	echo funcdebug line}trap 'echo [$LINENO] debug' DEBUGecho debug linetrapfunctraptrap 'echo ${FUNCNAME:-$0}[$LINENO] debug' DEBUGfunc2(){	echo func2debug line}declare -ft func2func2unset -f func2trap '' DEBUGtraptrap - debugtraptrap - HUPtrap huptrap '' INTtrap '' inttrap# exit 0 in exit trap should set exit status(set -etrap 'exit 0' EXITfalse   echo bad)echo $?# hmmm...should this set the handling to SIG_IGN for children, too?trap '' USR2./trap1.sub# test ERR trap./trap2.sub${THIS_SH} ./trap3.sub## show that setting a trap on SIGCHLD is not disastrous.#set -o monitortrap 'echo caught a child death' SIGCHLDsleep 7 & sleep 6 & sleep 5 &# this will only catch the first, since there's a trap on SIGCHLDwaittrap -p SIGCHLD# Now reset some of the signals the shell handles specially back to# their default values (with or without the SIG prefix)trap - SIGINT QUIT TERMtraptrap - SIGCHLDwait

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -