#!/bin/sh

trap_with_arg() {
  func="$1"
  shift
  for sig; do
    trap '${func} ${sig}' "${sig}"
  done
}

func_trap() {
  echo "Trapped: $1"
}

trap_with_arg func_trap INT TERM EXIT

printf '%s\n' "Send signals to PID $$ and type [enter] when done."
read -r  # wait so the script doesn't exit.
