Subject: Re: Killing processes by name
To: None <current-users@NetBSD.ORG, mrg@eterna.com.au, arnej@pvv.unit.no>
From: Wolfgang Solfrank <ws@kurt.tools.de>
List: current-users
Date: 04/12/1996 14:04:57
> > oh, and /bin/kill on solaris:
> >
> > svr4islame ~# cat /bin/kill
> > /bin/sh -c "kill $*"
>
> Yeuch. Can you spot the 2.5 errors in this one?
>
> 1) It's not executable by execve(), only from shells which guess
> that all executable files returning exec format error is a script.
> 2) Since it's going to be run as a script anyway, you don't need
> to start *another* shell, so you could skip the extra /bin/sh -c.
> 2.5) One shouldn't use $* when interpolating paramters. This
> I only count as half an error since kill doesn't work with strange
> spacing or whatever anyway, but it should give saner errors if you try
> something weird.
>
> #!/bin/sh
> kill "$@"
>
> would have been a lot better...
Actually, it is more like this than the one given by Matthew, at least on
my copy of Solaris 2.5.
The file starts with
#!/bin/ksh
Then follows the obligatory copyright notice!
and then they do the equivalent of (not wanting to violate their precious
copyright :-)):
`basename $0` "$@"
Obviously, they automatically generate links for this script with the names
of all builtin commands, including alias, bg, cd, command, fc, fg, hash, jobs,
read, ulimit, umask, unalias and wait. Actually, it would have been
easier to cite the remaining 4 commands, for which it makes sort of sense :-).
For completeness, despite kill those are getopts, test and type.
And, BTW, the file is still version 1.1!
--
ws@TooLs.DE (Wolfgang Solfrank, TooLs GmbH) +49-228-985800