trap - INT TERM EXIT
# script cleanup here

# saved_tty_settings="$('command' 'stty' '-g')"
# cleanup() {
#   'trap' '-' 'INT' 'TERM' 'EXIT'
#   'command' 'rm' '-f' '--' "$file" "${files-}"
#   'command' 'stty' "$saved_tty_settings"
# }
# 'trap' 'cleanup' 'INT' 'TERM' 'EXIT'

# # make a cleanup function
# cleanup() {
#   rm --force -- "${tmp}"
# }
# # trap the special "EXIT" group, which is always run when the shell exits.
# trap cleanup EXIT
# # create a temporary file
# tmp="$(mktemp -p /tmp tmpfileXXXXXX)"

# echo "Hello, world!" >> "${tmp}"

# # no rm -f "$tmp" needed. the advantage of using EXIT is that it still works
# # even if there was an error or if you used exit.

# cleanup() {
#   trap - EXIT INT HUP TERM
#   # kill -1 $socatpid || true
#   rm -f "$.." "$.."
# }
# trap cleanup EXIT INT HUP TERM
