| delorie.com/archives/browse.cgi | search |
| Date: | Tue, 06 May 2003 20:06:35 +0300 |
| From: | "Eli Zaretskii" <eliz AT elta DOT co DOT il> |
| Sender: | halo1 AT zahav DOT net DOT il |
| To: | m DOT collado AT aaron DOT ls DOT fi DOT upm DOT es |
| Message-Id: | <9003-Tue06May2003200634+0300-eliz@elta.co.il> |
| X-Mailer: | emacs 21.3.50 (via feedmail 8 I) and Blat ver 1.8.9 |
| CC: | djgpp AT delorie DOT com |
| In-reply-to: | <3EB7C0D6.7030206@lml.ls.fi.upm.es> (message from Manuel Collado |
| on Tue, 06 May 2003 16:04:06 +0200) | |
| Subject: | Re: gawk 3.1.1: bug in stdout redirection on WinNT 4.0 |
| References: | <3EB7C0D6 DOT 7030206 AT lml DOT ls DOT fi DOT upm DOT es> |
| Reply-To: | djgpp AT delorie DOT com |
| Errors-To: | nobody AT delorie DOT com |
| X-Mailing-List: | djgpp AT delorie DOT com |
| X-Unsubscribes-To: | listserv AT delorie DOT com |
> Date: Tue, 06 May 2003 16:04:06 +0200
> From: Manuel Collado <m DOT collado AT aaron DOT ls DOT fi DOT upm DOT es>
> Newsgroups: comp.os.msdos.djgpp
>
> The following commands correctly execute from a bash shell
>
> F:\PRUEBAS\gawkbug>cat gawkbug
> # Test gawk
> gawk "BEGIN {printf(\"================first\")}"> out.txt
> gawk "BEGIN {printf(\"++++second+\");}">> out.txt
> echo -----------------------
> cat out.txt
> echo
> echo -----------------------
> gawk --version
>
> F:\PRUEBAS\gawkbug>bash gawkbug
> -----------------------
> ================first++++second+
> -----------------------
> GNU Awk 3.1.1
> Copyright (C) 1989, 1991-2002 Free Software Foundation.
> [snipped]
>
> But the equivalent MS-DOS set of commands fail from a cmd shell
>
> F:\PRUEBAS\gawkbug>cat gawkbug.bat
> @echo off
> gawk "BEGIN {printf(\"================first\")}"> out.txt
> gawk "BEGIN {printf(\"++++second+\");}">> out.txt
> echo -----------------------
> type out.txt
> echo.
> echo -----------------------
> gawk --version
>
> F:\PRUEBAS\gawkbug>gawkbug
> -----------------------
> ++++second+=====first
> -----------------------
You are using the quote characters inside quoted strings; DOS/Windows
shells do not cope well with these. I suggest to try these commands
instead:
gawk 'BEGIN {printf(\"================first\")}'> out.txt
gawk 'BEGIN {printf(\"++++second+\");}'>> out.txt
That is, use single quotes instead of double quotes for the outer
quotes. That should work in either shell.
> The weird thing is that the previous version of gawk doesn't suffers
> this malfunction:
>
> F:\PRUEBAS\gawkbug>gawkbug
> -----------------------
> ================first++++second+
> -----------------------
> GNU Awk 3.0.6
I have no idea why the older Gawk worked. Perhaps you use a non-DJGPP
port of that version, or maybe the DJGPP startup code that deals with
quotes has changed between the two ports.
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |