bug-gawk
[Top][All Lists]
Advanced

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

Re: [bug-gawk] abort keyword


From: Neil R. Ormos
Subject: Re: [bug-gawk] abort keyword
Date: Mon, 8 Jan 2018 10:53:44 -0600 (CST)

address@hidden wrote:

> Changed the subject line.

> "Neil R. Ormos" <address@hidden> wrote:

>> But for shorter programs written for an ephemeral
>> need, an abort statement that does not require the
>> inclusion of library functions or additional -f
>> arguments, and a specific test in the END rule,
>> would save a lot of extra typing and design
>> attention.  I write a lot of such one-off
>> programs, often on the command-line.

> I think a workable solution is a shell script
> that invokes gawk with the options and
> arguments previded, but that preloads useful
> things like abort, assert, etc.

That's a fine solution for situations where the
user is in a position to fully customize the
environment.

It's not optimal for some other use cases.
Examples include systems being built, where the
operating environment has not yet been customized;
recovery environments where the user's home
directory is broken or unavailable; and other
situations where the customization might interfere
with other uses of Gawk or simply confuse others.

When I don't need to rely on Gawk's exit status,
I've been using divide-by-zero as an expedient
abort.  Having an abort keyword that, like exit,
allows the return code to be explicitly set, would
be better.



reply via email to

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