On Tue, Feb 15, 2011 at 5:30 PM, Jason McIntyre <j...@cava.myzen.co.uk> wrote: > On Mon, Feb 14, 2011 at 11:31:18AM +0000, David Julio wrote: >> Is the exit status of which(1)/whereis(1) correct? >> >> $ which a b c >> which: a: Command not found >> which: b: Command not found >> which: c: Command not found >> >> $ echo $? >> 2 >> >> $ which -a a b c >> which: a: Command not found >> which: b: Command not found >> which: c: Command not found >> >> $ echo $? >> 1 >> >> If it is incorrect, below is my attempt to contribute. >> >> Thank you for your time. >> > > i have no access to such systems, but maybe someone who does can tell us > how other bsd behave? > > jmc
NetBSD's which(1)/whereis(1) return 0 if all names were successfully resolved, 1 for errors, 2 if some names were resolved and 3 if none were. The man page for which doesn't document the exit status but the man page for whereis does. The exit status is the same with and without -a.