bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lint warning: unnecessary mixing of `>' and `>>'


From: Hermann Peifer
Subject: lint warning: unnecessary mixing of `>' and `>>'
Date: Thu, 19 Oct 2023 22:34:39 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.15.1

Hi again.

Here a *small* observation.

For me, the lint warning makes sense in #1, but the mixture in #2 is not
necessarily unnecessary, as the intention of the user could well be to
append to any pre-existing file.

Hermann

[~]> #1: So far, so good
[~]> awk --lint 'BEGIN { f="out.dat"; print "Hello" > f; print "World"
>> f; close(f) }'
awk: cmd. line:1: warning: unnecessary mixing of `>' and `>>' for file
`out.dat'
[~]>
[~]> #2: An unnecessary mixture here? Most likely not.
[~]> awk --lint 'BEGIN { f="out.dat"; print "Hello" >> f; print "World"
> f; close(f) }'
awk: cmd. line:1: warning: unnecessary mixing of `>' and `>>' for file
`out.dat'
[~]>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]