pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew.dunstan@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
To: Nikolay Shaplov <dhyan@nataraj.su>
Cc: pgsql-hackers@lists.postgresql.org, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: Витус Вагнер <vitus@wagner.pp.ru>
Subject: Re: [PATCH] check for ctags utility in make_ctags
Date: Sun, 6 Jan 2019 17:50:36 -0500
Message-ID: <249c110c-1a30-87bf-2bb8-bc84265c1eeb@2ndQuadrant.com> (raw)
In-Reply-To: <5709.1546794967@sss.pgh.pa.us>
References: <2394207.ccz7JgCJsh@x200m>
	<2205856.meAnofT0VS@x200m>
	<364f4cb7-4f1f-516e-d27e-59578b7cf18c@2ndquadrant.com>
	<96675367.WEgyTzNvEp@x200m>
	<5709.1546794967@sss.pgh.pa.us>


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





view thread (14+ messages)  latest in thread

Message-ID: <249c110c-1a30-87bf-2bb8-bc84265c1eeb@2ndQuadrant.com>
Permalink:  ../249c110c-1a30-87bf-2bb8-bc84265c1eeb@2ndQuadrant.com/
Also on:    postgresql.org/message-id/249c110c-1a30-87bf-2bb8-bc84265c1eeb@2ndQuadrant.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: andrew.dunstan@2ndquadrant.com, tgl@sss.pgh.pa.us, dhyan@nataraj.su, peter.eisentraut@2ndquadrant.com, michael@paquier.xyz, vitus@wagner.pp.ru
  Subject: Re: [PATCH] check for ctags utility in make_ctags
  In-Reply-To: <249c110c-1a30-87bf-2bb8-bc84265c1eeb@2ndQuadrant.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox