Gentoo Archives: gentoo-dev

From: ulm@kph.uni-mainz.de (Ulrich Mueller)
To: gentoo-dev@l.g.o
Cc: Mike Frysinger <vapier@g.o>
Subject: Re: [gentoo-dev] dont use `which` in ebuilds
Date: Wed, 14 Mar 2007 10:22:28
Message-Id: 200703121915.38528.vapier@gentoo.org
In Reply to: [gentoo-dev] dont use `which` in ebuilds by Mike Frysinger
1 >>>>> On Tue, 13 Mar 2007, Mike Frysinger wrote:
2
3 > `type -p` is almost a complete drop in replacement for which ...
4 > it does not work on bash builtins however, so people should use
5 > `type -P` to force the PATH search
6
7 > in other words, `type -p echo` would return "" while `type -P echo`
8 > would return "/bin/echo"
9
10 But in spite of this, "type -p" will still have the correct return
11 value, so your first example remains valid:
12
13 >> -if which foo 2>/dev/null ; then
14 >> +if type -p foo > /dev/null ; then
15
16 Ulrich
17 --
18 gentoo-dev@g.o mailing list