My question is why there are two different error messages for same command in two different shell?
Because kill
is a shell-builtin (at least on bash
). This implies that is using bash
, saying kill ...
would execute the shell builtin and not the binary that might reside in /bin
or /usr/bin
.
$ echo $SHELL
/bin/bash
$ type kill
kill is a shell builtin
$ kill
kill: usage: kill [-s sigspec | -n signum | -sigspec] pid | jobspec ... or kill -l [sigspec]
$ which kill
/bin/kill
$ /bin/kill
usage: kill [-s signal_name] pid ...
kill -l [exit_status]
kill -signal_name pid ...
kill -signal_number pid ...
You could disable the shell-builtins in bash
by making use of the enable
builtin:
$ enable -n kill
$ kill
usage: kill [-s signal_name] pid ...
kill -l [exit_status]
kill -signal_name pid ...
kill -signal_number pid ...
(Invoking kill
after disabling the builtin invokes the system /bin/kill
instead.)