Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uwm.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!ark1!nems!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.unix.questions Subject: Re: Funny kill -9 behaviour Message-ID: <26072@mimsy.umd.edu> Date: 18 Aug 90 23:11:28 GMT References: <909@sagpd1.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 37 In various articles various people ask why kill -9 `some expression` produces `some expression`: Ambiguous The reason is that kill is a C-shell built-in, these people are using the C-shell, and the C-shell is (to an amazingly large extent, given that it `works' for most uses) quite thoroughly broken inside. The kill code expands the backquote expression, finds that it breaks into several words, and complains (instead of iterating over each of the words). This does not happen with kill -9 several words because here the expansion occurs before the built-in kill function. Note that kill *must* be a built-in, since `kill %2' has to convert the `%2' to a `job' (and %n does not normally expand to a list of process IDs, which is the obvious way to do this without a built-in). So: workarounds: eval kill arguments `expression` /bin/kill arguments `expression` The latter runs one more process, does not interpret `%'s, and is dependent on the location of the `kill' program. The former simply causes the backquote expression to be expanded before calling the internal `kill' routine. -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@cs.umd.edu Path: uunet!mimsy!chris (New campus phone system, active sometime soon: +1 301 405 2750)