[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: quoting in heredocs zsh vs. /bin/sh
- To: ports_(_at_)_openbsd_(_dot_)_org
- Subject: Re: quoting in heredocs zsh vs. /bin/sh
- From: naddy_(_at_)_mips_(_dot_)_inka_(_dot_)_de (Christian Weisgerber)
- Date: Mon, 2 Feb 2004 15:54:26 +0000 (UTC)
- Newsgroups: list.openbsd.ports
Greg Steuck <greg-openbsd-ports_(_at_)_y2004_(_dot_)_nest_(_dot_)_cx> wrote:
> cat >>conftest.$ac_ext <<_ACEOF
> ... stuff
> printf("(found \"%s\")... ", lua_version());
> ... more stuff
> _ACEOF
>
> executing this fragment with /bin/sh results in:
> printf("(found "%s")... ", lua_version());
>
> executing with /bin/zsh results in:
> printf("(found \"%s\")... ", lua_version());
>
> Is OpenBSD ksh doing the right thing here?
Apparently not. Hmm.
SUSv3 says:
If no characters in [the delimiter] are quoted, all lines of the
here-document shall be expanded for parameter expansion, command
substitution, and arithmetic expansion. In this case, the backslash
in the input behaves as the backslash inside double-quotes (see
Double-Quotes).
>From this I would say that our shell actually does the right thing.
Alas, no other shell agrees. I quickly checked Solaris sh, FreeBSD sh,
ksh88, bash2. They all preserve the backslashes.
> Should the test be fixed or the shell?
Well, in the short term you'll be better off changing the test.
--
Christian "naddy" Weisgerber naddy_(_at_)_mips_(_dot_)_inka_(_dot_)_de
Visit your host, monkey.org