type output only if command succeeded.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175843
138bc75d-0d04-0410-961f-
82ee72b054a4
+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 Jason Merrill <jason@redhat.com>
* g++.dg/abi/mangle48.C: New.
# 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
}