Opened 11 years ago

Closed 11 years ago

#2130 closed bug (fixed)

[which] behaves unexpected

Reported by: andreasf Owned by: axeld
Priority: normal Milestone: R1
Component: Applications/Command Line Tools Version: R1/pre-alpha1
Keywords: Cc:
Blocked By: Blocking:
Has a Patch: no Platform: x86

Description

The exit code of which is not inline with the expectations of some ./autogen.sh and similar scripts.

which someexistingtool || echo "You need someexitingtool >= 0.2"

is expected to print the message iff someexistingtool is not found. On Haiku it is sometimes inversed.

Change History (3)

comment:1 by bonefish, 11 years ago

Resolution: fixed
Status: newclosed

Fixed in hrev25169.

comment:2 by andreasf, 11 years ago

Resolution: fixed
Status: closedreopened

Not quite fixed yet...

When running from the Terminal it appears to work as expected now, but not from inside a script:

cat test-which.sh:

#!/bin/sh
which gcc || echo $?

which gcc || echo $?:

/boot/develop/tools/gnupro/bin/gcc

./test-which.sh:

./test-which.sh: line 2: which: command not found
127

comment:3 by bonefish, 11 years ago

Resolution: fixed
Status: reopenedclosed

Fixed in hrev25190.

Note: See TracTickets for help on using tickets.