2002-06-03 14:36:49 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# self-destruct.sh
|
|
|
|
|
|
|
|
kill $$ # Script kills its own process here.
|
|
|
|
# Recall that "$$" is the script's PID.
|
|
|
|
|
|
|
|
echo "This line will not echo."
|
|
|
|
# Instead, the shell sends a "Terminated" message to stdout.
|
|
|
|
|
2006-12-20 21:11:55 +00:00
|
|
|
exit 0 # Normal exit? No!
|
2002-07-22 15:11:51 +00:00
|
|
|
|
|
|
|
# After this script terminates prematurely,
|
|
|
|
#+ what exit status does it return?
|
|
|
|
#
|
|
|
|
# sh self-destruct.sh
|
|
|
|
# echo $?
|
|
|
|
# 143
|
|
|
|
#
|
|
|
|
# 143 = 128 + 15
|
|
|
|
# TERM signal
|