[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Public service announcement about Policy 10.4



Thomas Hood <jdthood@aglu.demon.nl> wrote:
[command -v]
> It is not even useful as a which(1) replacement.  Whereas "which"
> prints the pathname of the first executable file on the PATH,
> "command -v" prints the pathname of the first executable file on the
> PATH _or_ the pathname of the first non-executable file on the PATH.

s/_or_/or - if there is matching executable at all in PATH -/

But thanks for the information anyway, I did not know about this
unwelcome behavior.

[...]
> For these reasons the use of "command -v" should be avoided in
> /bin/sh scripts and I would say that posh is right to omit it.

FWIW I am using command -v in one of my maintainerscripts, as I needed
to check whether $command which (currently) is an alias of shell-function
exists:

if command -v db_settitle > /dev/null 2>&1; then
        db_settitle exim4/exim4-config-title 2>/dev/null || true
fi

This is going to be removed soon, when we drop woody compability, but
might need to be used later again, as debconf evolves.
             cu andreas
-- 
"See, I told you they'd listen to Reason," [SPOILER] Svfurlr fnlf,
fuhggvat qbja gur juveyvat tha.
Neal Stephenson in "Snow Crash"
                                           http://downhill.aus.cc/



Reply to: