D1382.trap.bashrc (805B)
1 #!/bin/bash 2 3 function is-interactive-execution { 4 (alias false=true; eval false) 5 } 6 7 # これは駄目。その場で実行される。 8 function sub:attach-signal { 9 trap 'echo USR2' USR2 10 #kill -USR2 $$ 11 kill -USR2 $$ & 12 } 13 14 function sub:attach-debug/handler { 15 echo "[$LINENO:$HISTCMD:$-] $BASH_COMMAND" 16 #echo "opts=$BASHOPTS" 17 is-interactive-execution; echo "interactive? $?" 18 declare -p FUNCNAME BASH_LINENO BASH_SOURCE 19 } 20 function sub:attach-debug { 21 trap 'sub:attach-debug/handler' DEBUG 22 } 23 sub:attach-debug 24 25 #echo "\$*=($*)" 26 #declare marker=this_is_bashrc 27 28 function sub:check-bashrc { 29 shopt -u extdebug 30 echo "BASH_ENV=$BASH_ENV" 31 declare | grep D0000.trap.bashrc 32 } 33 34 #echo "LINENO=$LINENO" 35 36 sleep 0.2 37 echo Middle of Bashrc 38 sleep 0.2 39 echo End of Bashrc 40 PROMPT_COMMAND='echo Prompt Command'