bug-ed
[Top][All Lists]
Advanced

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

Re: A suggestion to add to gnu ed: command line option to start on line


From: John Cowan
Subject: Re: A suggestion to add to gnu ed: command line option to start on line foo or bar.
Date: Tue, 28 Feb 2023 13:16:22 -0500

On Tue, Feb 28, 2023 at 11:17 AM Antonio Diaz Diaz <antonio@gnu.org> wrote:

I agree that ed should perhaps behave differently in the interactive and
> scripted cases, but I think we can use the existing option '-l,
> --loose-exit-status' to ignore a mismatch in the interactive case instead
> of
> using a new option to force an error in the scripted case.
>

Per contra, the point of the proposed -e option is to force an immediate
exit on error.  For example, suppose we want to edit a file using a script
that removes all except certain lines (using the 'v' command) and then
writes out the file.  But if there are no such lines, it is not the right
file.

This situation will cause ed to return an error message and code, but the
file (now empty) will still be written out, which is a Very Bad Thing.  The
proposed -e option will abort ed as soon as the search fails rather than
carrying on to the end of the script and only then returning an error.  The
same would be the case if the purpose of the script was to delete lines
100-200 and there were no such lines.


reply via email to

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