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

Re: command -v in postinsts violating policy



On Mon, May 27, 2002 at 07:52:14AM -0700, Jim Lynch wrote:
> (man which will be useful to verify this, altho it's not all that
> specific: in that context, "returns" is really "streams to stdout,"
> and -not- "returned as exit status," which wouldn't make sense for a
> string anyway. Know your commands... it's useful when you're posting
> about them :)

Except that, while it isn't documented, our version of which does have a
useful exit status:

  [cjwatson@arborlon ~]$ which foo
  [cjwatson@arborlon ~]$ echo $?
  1
  [cjwatson@arborlon ~]$ which install-docs
  /usr/sbin/install-docs
  [cjwatson@arborlon ~]$ echo $?
  0

SUSv2 and SUSv3 say that type (the last command executed by which)
returns non-zero if "an error occurred". I'm assuming that all shells
interpret "couldn't find any matches for the given name" as an error for
this purpose.

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]


-- 
To UNSUBSCRIBE, email to debian-devel-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: