trap allows you to specify an arbitrary command (or sequence of commands), but you must pass this command as a single argument. For example, this:
trap 'foo bar baz | bip && fred barney ; wilma' SIGINT
will run this:
foo bar baz | bip && fred barney ; wilma
whenever the shell receives a SIGINT. In your case, it sounds the way you want:
trap '<function> <arg_1> <arg_2>' SIGINT
ruakh
source share