Re: [HACKERS] Re: initdb.sh fixed

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>
Subject: Re: [HACKERS] Re: initdb.sh fixed
Date: 1999-12-20 05:24:17
Message-ID: 18115.945667457@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> We currently have:
> EffectiveUser=`id -n -u 2>/dev/null` || EffectiveUser=`whoami 2>/dev/null`

OK, but is that really portable? I'd feel more comfortable with

EffectiveUser=`id -n -u 2>/dev/null || whoami 2>/dev/null`

because it's clearer what will happen. I wouldn't have expected an
error inside a backquoted subcommand to determine the error result of
the command as a whole, which is what the first example is depending on.
In a quick test it seemed to work with the ksh I tried it on, but I
wonder how many shells work that way...

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-12-20 05:38:37 Re: [HACKERS] Re: initdb.sh fixed
Previous Message Bruce Momjian 1999-12-20 04:40:52 Re: [HACKERS] Re: initdb.sh fixed