@Haelwenn /элвэн/ :triskell: @navi You can't use getopt since the first argument can be negative and kill does not enforce a -- at the end of the options.
You need to parse the command line unconditionally interpreting the last word as an argument and doing a limited getopt on the start. And if you get kill -1 -2 -3 then it's ambiguous.
I would love to toss the -signum usage, but it's so fossilized by history that you can't. kill -9 -1 is the common definition of a nuke, and kill -s KILL -1 just doesn't pack the same punch.
If you want another example, try implementing test following the exact specification. It's a true horror show.