|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
Re: quoting in heredocs zsh vs. /bin/sh
From: Christian Weisgerber (naddy
mips.inka.de)
Date: Mon Feb 02 2004 - 09:54:26 CST
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Greg Steuck <greg-openbsd-ports
y2004.nest.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
mips.inka.de
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]