pdksh vs wine
Radoslaw Zielinski
radek at karnet.pl
Wed Feb 19 23:48:11 CET 2003
Jakub Bogusz <qboosh at pld.org.pl> [19-02-2003 20:09]:
[...]
> cat >>conftest.$ac_ext <<_ACEOF
> /* end confdefs.h. */
> void ac_asm(void) { asm(".data\n\t.string \"test\"\n\t.text"); }
[...]
> Wg SUSv2 raczej to ksh robi źle, choć nie jest to napisane tak
> jednoznacznie... ("will not be treated specially" - ale w jakim kontekście?
> gdyby nie wyrażenie "having a special meaning" w drugim fragmencie,
> bliższy byłbym uznania, że to ksh jest OK).
Z tego, co widzę, to działa +-tak, jak w Perlu. Jeśli ,,word'', czyli
_ACE0F w tym przypadku jest ujęty w pojedyńcze cudzysłowy ('), to
zawartość HERE_DOC nie jest interpolowana (tzn. nie są rozwiązywane np.
zmienne). Tak, jakby ciąg znaków do kończącego delimitera był ujęty w
takie cudzysłowy (bez stosowania konstrukcji HERE_DOC). Natomiast
domyślnie zakłada się ", czyli interpolację.
Przykłady:
$ cat test.sh
cat <<'_ACEOF'
void ac_asm(void) { asm(".data\n\t.string \"test\"\n\t.text"); }
_ACEOF
cat <<_ACEOF
void ac_asm(void) { asm(".data\n\t.string \"test\"\n\t.text"); }
_ACEOF
cat <<"_ACEOF"
void ac_asm(void) { asm(".data\n\t.string \"test\"\n\t.text"); }
_ACEOF
$ ksh test.sh
void ac_asm(void) { asm(".data\n\t.string \"test\"\n\t.text"); }
void ac_asm(void) { asm(".data\n\t.string "test"\n\t.text"); }
void ac_asm(void) { asm(".data\n\t.string \"test\"\n\t.text"); }
$ cat test.pl
print <<'_ACEOF';
void ac_asm(void) { asm(".data\n\t.string \"test\"\n\t.text"); }
_ACEOF
print <<_ACEOF;
void ac_asm(void) { asm(".data\n\t.string \"test\"\n\t.text"); }
_ACEOF
print <<"_ACEOF";
void ac_asm(void) { asm(".data\n\t.string \"test\"\n\t.text"); }
_ACEOF
$ perl test.pl
void ac_asm(void) { asm(".data\n\t.string \"test\"\n\t.text"); }
void ac_asm(void) { asm(".data
.string "test"
.text"); }
void ac_asm(void) { asm(".data
.string "test"
.text"); }
Jak dla mnie, ksh jest w tym wypadku OK (przynajmniej tak rozumiem
tekst, który zacytowałeś). Wniosek: wystarczy ujęcie _ACEOF w '.
--
Radosław Zieliński <radek at karnet.pl>
[ GPG key: http://radek.karnet.pl/ ]
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: </mailman/pipermail/pld-devel-pl/attachments/20030219/7cc9aa33/attachment.sig>
More information about the pld-devel-pl
mailing list