* ada/acats/run_acats (which): Extract last field from type -p,
type output only if command succeeded.
From-SVN: r175845
+2011-07-05 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * ada/acats/run_acats (which): Extract last field from type -p,
+ type output only if command succeeded.
+
2011-07-04 Richard Guenther <rguenther@suse.de>
Backport from mainline
# Fall back to whence which ksh88 and ksh93 provide, but bash does not.
which () {
- path=`type -p $* 2>/dev/null | awk '{print $NF}'` && { echo $path; return 0; }
- path=`type $* 2>/dev/null | awk '{print $NF}'` && { echo $path; return 0; }
+ path=`type -p $* 2>/dev/null` && { echo $path | awk '{print $NF}'; return 0; }
+ path=`type $* 2>/dev/null` && { echo $path | awk '{print $NF}'; return 0; }
path=`whence $* 2>/dev/null` && { echo $path; return 0; }
return 1
}