Ticket #2130 (closed bug: fixed)

Opened 15 months ago

Last modified 14 months ago

[which] behaves unexpected

Reported by: andreasf Owned by: axeld
Priority: normal Milestone: R1
Component: Applications/Command Line Tools Version: R1 development
Cc: Blocked By:
Platform: x86 Blocking:

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

Changed 14 months ago by bonefish

  • status changed from new to closed
  • resolution set to fixed

Fixed in r25169.

Changed 14 months ago by andreasf

  • status changed from closed to reopened
  • resolution fixed deleted

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

Changed 14 months ago by bonefish

  • status changed from reopened to closed
  • resolution set to fixed

Fixed in r25190.

Note: See TracTickets for help on using tickets.