nginx-tests: replace non posix "which" with posix "command"

Maxim Dounin mdounin at
Sun May 9 14:54:00 UTC 2021


On Sun, May 09, 2021 at 02:28:52PM +0500, Илья Шипицин wrote:

> please find attached patch.
> it improves experience by using generally available posix "command" instead
> of "which"

The last time I've tried it, it didn't work due to no "command" 
binary on Linux:

changeset:   232:4c43b3a0117c
user:        Maxim Dounin <mdounin at>
date:        Mon Sep 10 19:55:12 2012 +0400
files:       lib/Test/
Tests: revert 5db96b64cead, use "which" instead of "command -v".

It turns out that Linux doesn't have "command -v" (there are shell builtins,
but no standalone binary).  Use "which" instead, and provide a special case
for Solaris.


It's still the case at least on Ubuntu 20.10, leading to tests 
being incorrectly skipped on Linux if "command -v" is used instead 
of "which".

Maxim Dounin

More information about the nginx-devel mailing list