3

The Internet is unanimous: kill is a Bash builtin. Bash changelog says the same.

However my other builtins apparently think otherwise:

$ builtin kill
bash: builtin: kill: not a shell builtin
$ type kill
kill is /bin/kill
$ command -V kill
kill is /bin/kill

This happens even though help kill gives documentation and man bash mentions kill in its “SHELL BUILTIN COMMANDS” section (but, if we start to interpret signs, elsewhere in the manual, it is only referred to as “the kill command”, whereas confirmed builtins are referred to as e.g. “the wait builtin”).

What is going on here? Is this part of a plan? I am running Bash 5.0.2 on Linux.

3
  • 3
    Which distribution are you running, or is this a home-compiled version of bash ? Or do you have enable -n kill in your .profile (and related files) that would disable the builtin ? Commented Mar 31, 2019 at 2:38
  • 3
    Oh you’re right, I have had enable -n kill for so long I forgot about it, and about the whole enabling/disabling mechanism. Well this is embarrassing.
    – Maëlan
    Commented Mar 31, 2019 at 2:47
  • 1
    This is a valid question. According to comments, it did not go away on its own. OP responded to a comment, and did something about it. Commented Mar 31, 2019 at 9:39

1 Answer 1

4

kill is and has always been a built-in utility in bash like in was in the Korn shell. It needs to be built-in in order to be able to kill shell jobs (like with kill %1) as those job numbers are indexes in an internal table of the shell which an external kill could not know anything about.

Built-in utilities may be disabled using the enable command with its -n option.

It is clear from comments that you've had

enable -n kill

in one of your shell's startup files, which disables the built-in variant of the utility and forces the shell to use the external kill implementation in /bin/kill.

To resolve your issue, remove that command from whatever shell startup file it occurs in.

Not the answer you're looking for? Browse other questions tagged .