Re: pg_ctl failure with older Bourne shells (use ${1:+"$@"})

Поиск
Список
Период
Сортировка
От Coleman, Michael
Тема Re: pg_ctl failure with older Bourne shells (use ${1:+"$@"})
Дата
Msg-id 94F8974916A79949ACBCCCF5D3711F73060986@exchkc03.stowers-institute.org
обсуждение исходный текст
Ответ на pg_ctl failure with older Bourne shells (use ${1:+"$@"})  (Mike Coleman <mkc@stowers-institute.org>)
Список pgsql-bugs
Blah.  Yeah, I muffed that--don't use a colon.

Regarding Bruce's comment, you wouldn't think they're still around, but thi=
s is what /bin/sh does on Tru64 5.1.  (5.1 is almost the latest version; th=
ere's a 5.1a.)

Mike


> -----Original Message-----
> From: Tom Lane [mailto:tgl@sss.pgh.pa.us]
> Sent: Friday, July 19, 2002 9:38 AM
> To: Bruce Momjian
> Cc: Coleman, Michael; pgsql-bugs@postgresql.org; mkc@mathdogs.com
> Subject: Re: [BUGS] pg_ctl failure with older Bourne shells (use
> ${1:+"$@"})=20
>=20
>=20
> Bruce Momjian <pgman@candle.pha.pa.us> writes:
> > Yes, I have seen this fix before.  Are people still using=20
> shells that
> > don't handle "$@" properly?  I guess so or you wouldn't=20
> have reported
> > it.
>=20
> I remember having submitted just such a patch a few years ago (for a
> different one of our scripts of course) when I was still using HPUX 9.
> I'm not sure if later HPUXen have better shells.  Plain=20
> /bin/sh on this
> platform is ancient.
>=20
> > We only use "$@" in a few places so I am applying this patch.
>=20
> Could you check for other scripts where the same thing may have snuck
> in?
>=20
> BTW, O'Reilly's "Unix Power Tools" recommends
>     ${1+"$@"}
> as the most portable replacement for "$@".  Mike's version has :+
> which is not the same.  My man page for the Bourne shell says
>=20
>      ${parameter:+word}
>                     If parameter is set and is non-null,=20
> substitute word;
>                     otherwise substitute nothing.
>=20
>      ...
>=20
>      If the colon (:) is omitted from the above expressions,=20
> the shell only
>      checks whether parameter is set or not.
>=20
> It looks to me like the book's method is more correct --- it=20
> won't mess
> up in the case where $1 has been explicitly given as "".
>=20
>             regards, tom lane
>=20

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

Предыдущее
От: "Pankaj Naug"
Дата:
Сообщение: help
Следующее
От: Bradley Kieser
Дата:
Сообщение: PG 7.1: VIEW returns fewer rows than equivalent select