Re: [PATCH] check for ctags utility in make_ctags - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: [PATCH] check for ctags utility in make_ctags
Date
Msg-id 249c110c-1a30-87bf-2bb8-bc84265c1eeb@2ndQuadrant.com
Whole thread Raw
In response to Re: [PATCH] check for ctags utility in make_ctags  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [PATCH] check for ctags utility in make_ctags  (Nikolay Shaplov <dhyan@nataraj.su>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: reducing the footprint of ScanKeyword (was Re: Large writable variables)
Next
From: Tom Lane
Date:
Subject: Re: Python versions (was Re: RHEL 8.0 build)