On 1/6/19 12:16 PM, Tom Lane wrote: > > The correct way to code this is to depend on the exit code, > not the text output: > > if command -v etags >/dev/null > then > : ok > else > echo etags not found > exit 1 > fi
more succinctly, command -v etags >/dev/null || { echo etags not found; exit 1;} > We could alternatively try to use "which" in the same way, > but I'm dubious that it's more portable than "command". > (AFAICT, "which" is *not* in POSIX.) > > Indeed. I know I have some systems where it's lacking. cheers andrew -- Andrew Dunstan https://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services