I understand that if I write my own shell scripts I maybe should use command -v instead, but this is not for my own shell scripts, but for compatibility with BSD and Mac.
Den mån 17 aug. 2020 kl 20:47 skrev Erik Gustafsson < ekir.gustafs...@gmail.com>: > I took Teemus very good suggestion and changed [-a] to [-as] now :) > > > https://salsa.debian.org/debian/debianutils/-/merge_requests/6/diffs#ed04ff4dabf1e2d4cd6b89136c2b24dec27ecca4_21_24 > > Is there anything more I should change? > > Who can merge? :) > > Den fre 14 aug. 2020 kl 16:07 skrev Simon McVittie <s...@debian.org>: > >> On Fri, 14 Aug 2020 at 14:46:39 +0200, Jonas Smedegaard wrote: >> > Regardless of the -s option, why is command preferred over which? Due >> > to it being POSIX or for some other reason? >> >> * command is POSIX, so any Unixish environment should have it, whereas >> which is non-standard, so it's anyone's guess whether it will exist >> on embedded, proprietary or otherwise limited Unixes >> (some upstream packages don't care about this, and Debian packages never >> have to, but for some upstream packages it matters) >> >> * relatedly, the which "API" is Unix folklore rather than formally written >> down, so it's easy to rely on features of one implementation that others >> don't have, like this -s option; debianutils which only has one option, >> -a, and GNU which also has that option, but it wouldn't surprise me if >> implementations exist that don't have -a >> >> * command is a shell builtin (I don't think the spec explicitly says so, >> but it can't work as documented unless it is), so "command -v java" >> is faster and more accurately reflects what your shell will actually do >> when you try to run java, typically on the next line of the same script >> >> smcv >> >>