trapper

来自「UNIX[1].shell范例精解(第4版)_code」· 代码 · 共 16 行

TXT
16
字号
#!/bin/bashfunction trapper () { 	echo "In trapper"	trap 'echo "Caught in a trap!"' INT 	# Once set, this trap affects the entire script. Anytime	# ^C is entered, the script will ignore it.}while :do	echo "In the main script"	trapper 	echo "Still in main"	echo "The pid is $$"	sleep 5done

⌨️ 快捷键说明

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