On Tue, Feb 28, 2023 at 11:17 AM Antonio Diaz Diaz <anto...@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.