Skip to contentSkip to conversation

configure

PATCH Juergen Keil 6 participants 8 messages May 9, 2007

lore
Share & tools
lore
#0 lore raw
Quoted 8 lines

Thiemo Seufer wrote:
Jeff Chua wrote:
[snip]

Quoted 3 lines
(quoted diff) +0 -0
@@ -567,7 +567,8 @@
   fi
 
Quoted 7 lines

Review line 571

Quoted 4 lines
(quoted diff) +2 -1
   # Check if tools are available to build documentation.
-if [ -x "`which texi2html`" ] && [ -x "`which pod2man`" ]; then
+if [ -x "`which texi2html 2>/dev/null`" \
+	-a -x "`which pod2man 2>/dev/null`" ]; then

Under which circumstances does "which" complain about unavailable executables?

Isn't the use of "which" wrong, anyway?

"which" belongs to csh/tcsh, and tells you about csh's/tcsh's idea about a command or a csh command alias.

IMO, for a /bin/sh (or bash) script, using the "type" command would be a better idea.

#1 lore raw
Quoted 7 lines · Juergen Keil

Isn't the use of "which" wrong, anyway?

"which" belongs to csh/tcsh, and tells you about csh's/tcsh's idea about a command or a csh command alias.

IMO, for a /bin/sh (or bash) script, using the "type" command would be a better idea.

"which" returns the first path, "type" returns all paths.

# type awk
awk is /bin/awk
awk is /usr/bin/awk
# which awk
/bin/awk
# type foo
-bash: type: foo: not found

Either way would work, but even with "type", it still needs to be "type foo 2>/dev/null".

Thanks,
Jeff.

#2 lore raw
Quoted 11 lines · Jeff Chua
Quoted 7 lines · Juergen Keil

Isn't the use of "which" wrong, anyway?

"which" belongs to csh/tcsh, and tells you about csh's/tcsh's idea about a command or a csh command alias.

IMO, for a /bin/sh (or bash) script, using the "type" command would be a better idea.

"which" returns the first path, "type" returns all paths.

You want "type -p".

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#3 lore raw
Quoted 5 lines · Andreas Schwab
Quoted 1 line · Jeff Chua

"which" returns the first path, "type" returns all paths.

You want "type -p".

# type awk
awk is /bin/awk
awk is /usr/bin/awk
# type -p awk
/bin/awk
/usr/bin/awk
# type foo
-bash: type: foo: not found
# type -p foo
#

Interesting. "type -p foo" does the same as "type foo 2>/dev/null", but only if "foo" is not found. Tried that on "awk" above, and it prints the paths.

Thanks,
Jeff.

#4 lore raw
Quoted 6 lines · Jeff Chua
# type awk
awk is /bin/awk
awk is /usr/bin/awk
# type -p awk
/bin/awk
/usr/bin/awk

You are not using type, but type -a.

Andreas.

Signature · 4 lines
Andreas Schwab, SuSE Labs, [email protected]
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
#5 lore raw
In reply to Juergen Keil
Quoted 7 lines · Juergen Keil

Isn't the use of "which" wrong, anyway?

"which" belongs to csh/tcsh, and tells you about csh's/tcsh's idea about a command or a csh command alias.

IMO, for a /bin/sh (or bash) script, using the "type" command would be a better idea.

Yes, 'which' is not reliable.

I already posted a patch regarding Mac OS X here:

http://lists.gnu.org/archive/html/qemu-devel/2007-04/msg00649.html

It fixes gcc detection only, because the other tools, that are detected by which, are installed anyway. This is of course not clean, but worked for the time.

Signature · 2 lines
Joachim Henke
http://base91.sourceforge.net/j-o/
#6 lore raw
Quoted 10 lines · Joachim Henke
Quoted 7 lines · Juergen Keil

Isn't the use of "which" wrong, anyway?

"which" belongs to csh/tcsh, and tells you about csh's/tcsh's idea about a command or a csh command alias.

IMO, for a /bin/sh (or bash) script, using the "type" command would be a better idea.

Yes, 'which' is not reliable.

"type" appears to be bash-specific, at least according to the bash documentation, so I stuck with "which" for now.

Thiemo

#7 lore raw
Quoted 7 lines · Thiemo Seufer
Quoted 6 lines · Joachim Henke
Quoted 5 lines · Juergen Keil

Isn't the use of "which" wrong, anyway?

"which" belongs to csh/tcsh, and tells you about csh's/tcsh's idea about a command or a csh command alias.

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

IMO, for a /bin/sh (or bash) script, using the "type" command would be a better idea.

Yes, 'which' is not reliable.

"type" appears to be bash-specific, at least according to the bash documentation, so I stuck with "which" for now.

You could use "command -v" from SUSv3.

Signature · 2 lines
Ben Pfaff 
http://benpfaff.org