OSDN Git Service

* ada/acats/run_acats (which): Extract last field from type -p,
authorro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Jul 2011 10:22:50 +0000 (10:22 +0000)
committerro <ro@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 5 Jul 2011 10:22:50 +0000 (10:22 +0000)
type output only if command succeeded.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@175843 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/testsuite/ChangeLog
gcc/testsuite/ada/acats/run_acats

index d496dbc..7a4b5bb 100644 (file)
@@ -1,3 +1,8 @@
+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.
index 5d68e6c..c1ed39f 100755 (executable)
@@ -14,8 +14,8 @@ fi
 # 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
 }