Skip to content

Commit aede085

Browse files
committed
Fix parsing of GNU which output
The GNU version of which outputs error messages as follows: $ which aaaaaa which: no aaaaaa in ... Note that the error message that starts with "no" is preceded by "which: ".
1 parent 22f5dfd commit aede085

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/misc/file

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ file_show_real_filename () {
110110
*)
111111
# AIX errors to stdout, ideally we'd use $? but which on Solaris doesn't exit() differently depending on result :(
112112
# TODO maybe we should break it out with uname checks?
113-
realfilename="`which \"\`basename \\\"${pattern}\\\"\`\" 2>&1 | egrep -v \"There is no |^no \"`"
113+
realfilename="`which \"\`basename \\\"${pattern}\\\"\`\" 2>&1 | egrep -v \"There is no |^(which: )?no \"`"
114114
if [ -n "${realfilename}" ]
115115
then
116116
printf -- "${realfilename}\n"

0 commit comments

Comments
 (0)