Shell builtin versions of standard commands have drawbacks
I'll start with a specific illustration of the general problem:
bash# kill -SIGRTMIN+22 1 bash: kill: SIGRTMIN+22: invalid signal specification bash# /bin/kill -SIGRTMIN+22 1 bash#
The first thing is that yes, this is Linux being a bit unusual.
Linux has significantly extended the usual range of Unix signal
numbers to include POSIX.1-2001 realtime signals,
and then can vary what
SIGRTMIN is depending on
how a system is set up. Once Linux had these extra signals (and
defined in the way they are), people sensibly added support for
them to versions of
kill. All of this is perfectly in accord
with the broad Unix philosophy; of course if you add a new facility
to the system you want to expose it to shell scripts when that's
Then along came Bash. Bash is cross-Unix, and it has a builtin
kill command, and for whatever reason the Bash people didn't
modify Bash so that on Linux it would support the
syntax (some possible reasons for that are contained in this
sentence). The results of that are a divergence between the
behavior of Bash's
kill builtin and the real
that have become increasingly relevant now that programs like
are taking advantage of the extra signals to allow you to control
more of their operations by sending them more signals.
Of course, this is a generic problem with shell builtins that
programs in any (and all) shells; it's not particularly specific
to Bash (zsh also has this issue on Linux, for example). There are
advantages to having builtins, including builtins of things like
kill, but there are also drawbacks. How best to fix or work around
them isn't clear.
kill is often a builtin in shells with job control, Bash included,
so that you can do '
kill %<n>' and the like. Things like
are often made builtins for shell script speed, although Unixes
can take that too far.)
PS: certainly one answer is 'have Bash implement the union of all
test, and so on features from all Unixes it runs
on', but I'm not sure that's going to work in practice. And Bash
is just one of several popular shells, all of whom would need to
keep up with things (or at least people probably want them to do
Comments on this page:Written on 29 September 2017.