[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: db3 configure dies at kill?



Jeff Sheinberg <jeffsh@erols.com> writes:

> Niels Möller writes:
>  >   exec kill "$@"
>                ^^^^
>  > 
>  > isn't good enough? If it has to be written in C for whatever reason, I
>  > guess GNU sh-utils is the right place.
> 
> How about using this construct to access the arguments, as it is
> more portable,
> 
>     exec kill ${@+"$@"}
> 
> since Korn shells (pdksh & ksh93) will give a "parameter not
> found" error for "$@" when the argument count ($#) is equal to
> zero.

That is a corner of portable sh programming I'm not really familiar
with. I guess what matters in the Hurd and GNU context is to stay
compatible with, in some order

  1. Posix /bin/sh
  2. Bash, and perhaps also ash, which are the only /bin/sh:s I've
     ever encounterned on GNU/Linux systems.
  3. Other random but common instances of /bin/sh on other free and
     proprietary unices.

And anyway, the behaviour of kill with no argument doesn't seem
terribly important. Trying the systems I'm currently logged in on,
the bahaviour vary:

Linux, bash builting:

  $ kill ; echo $?
  0

Linux, /bin/kill:

  $ /bin/kill ; echo $?
  usage: kill [ -s signal | -p ] [ -a ] pid ...
  	 kill -l [ signal ]
  1

Solaris, tcsh builtin:

  $ kill 
  kill: Too few arguments.
  $ echo $?
  1

Solaris, /bin/sh builtin:

  $ kill ; echo $?
  usage: kill [ [ -sig ] id ... | -l ]
  1

Solaris, /bin/kill:

  $ /bin/kill ; echo $?
  /bin/kill[8]: kill: bad argument count
  1

/Niels



Reply to: