Mail Archives: djgpp/2003/05/07/08:30:37
Eli Zaretskii wrote:
>>[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.
No, the bug has been found by executing awk scripts stored in files. The
example shown is only a minimal script to exercise the bug. BTW, it
seems that the 'cmd.exe' shell of WinNT 4.0 handles doubles quotes
correctly in the given example.
>
>
>>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.
I'm using the previous and latest DJGPP gawk versions supplied in the
distribution archives 'gwk306b.zip' and 'gwk311b.zip'. As said before,
it is not a question of interpreting quotes in command lines.
Apparently it may be an issue related to how the externally redirected
stdout handler is passed to gawk. And using bash or the native command
shell makes a difference.
For DJGPP gawk 3.1.1 on WinNT 4.0, what I find is that any redirection
of the form
gawk ..... >> outfile
always overwrites outfile from the beginning, but preserving the non
overwritten contents.
To diagnose if this is a bug, could anybody either reproduce the bug or
successfully append gawk output to a file?
Thanks,
--
To reply by e-mail, please remove the extra dot
in the given address: m.collado -> mcollado
- Raw text -