Re: [HACKERS] Re: initdb.sh fixed

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Re: initdb.sh fixed
Дата
Msg-id 18115.945667457@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Re: initdb.sh fixed  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: [HACKERS] Re: initdb.sh fixed  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Bruce Momjian <pgman@candle.pha.pa.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Re: initdb.sh fixed
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Re: initdb.sh fixed