bug-gawk
[Top][All Lists]
Advanced

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

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


From: Wolfgang Laun
Subject: Re: lint warning: unnecessary mixing of `>' and `>>'
Date: Mon, 23 Oct 2023 13:51:59 +0200

On Mon, 23 Oct 2023 at 13:38, <arnold@skeeve.com> wrote:

> Wolfgang Laun <wolfgang.laun@gmail.com> wrote:
>
> > It's not unusual that the same program could be used for writing a file
> > from scratch, or to append to it.
> > Except for the first print statement (i.e., the open), the code would be
> > the same. How would I
> > write it in order to remain consistent and in good style?
> >
> > Wolfgang
>
> The awk program should simply print[f] to standard output and the
> decision as to > or >> should be made at the shell level.
>
> So, if the decision between rewrite and append depends on the data
(or the date or ...) one should make this in the shell??

Forgive me, but I think that you cannot save awk from the lack of
an open with explicit mode and the indistinguishability of print >>x
and print >x by rules that must be broken.

Perhaps a really consistent and good style would be to wrap
both opens and the write in functions.

Wolfgang


> Arnold
>


-- 
Wolfgang Laun


reply via email to

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