Re: When scripting, which is better?

Поиск
Список
Период
Сортировка
От Justin Clift
Тема Re: When scripting, which is better?
Дата
Msg-id 3BB9812A.8BE56363@postgresql.org
обсуждение исходный текст
Ответ на Re: When scripting, which is better?  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-hackers
Sorry guys,

I didn't realise I actually sent this, it was part of an email I was
putting together to achieve consistency in the scripts, but I thought I
cancelled it when it got late in the morning.

My apologies.

Regards and best wishes,

Justin Clift


Bruce Momjian wrote:
> 
> > Hi all,
> >
> > Reading through the script files again, there seems to be several
> > different methods of doing the same thing :
> >
> > i.e.  if [ -x "$self_path/postmaster" ] && [ -x "$self_path/psql" ];
> > then
> 
> The above semicolon is useless.  Actually, I have never see this.  The
> normal way is:
> 
>         if [ -x "$self_path/postmaster" -a -x "$self_path/psql" ]
> 
> >
> > or
> >
> > if [[ -x "$self_path/postmaster" && -x "$self_path/psql" ]]; then
> 
> I usually do:
> 
>         if [ ... ]
>         then
> 
> Pretty simple.
> 
> >
> >
> >
> >
> > if [ x"$foo" = x"" ]; then
> >
> > or
> >
> > if [ "$op" = "" ]; then
> 
> This is done if you think $op may have a leading dash.
> 
> >
> > or
> >
> > if [ "$foo" ]; then
> >
> 
> This tests whether "$foo" is not equal to "".
> 
> --
>   Bruce Momjian                        |  http://candle.pha.pa.us
>   pgman@candle.pha.pa.us               |  (610) 853-3000
>   +  If your life is a hard drive,     |  830 Blythe Avenue
>   +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

-- 
"My grandfather once told me that there are two kinds of people: those
who work and those who take the credit. He told me to try to be in the
first group; there was less competition there."    - Indira Gandhi


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

Предыдущее
От: Hannu Krosing
Дата:
Сообщение: Re: But _where_ is the anoncvs server ?
Следующее
От: Vince Vielhaber
Дата:
Сообщение: Re: CVS changes