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: Antonio Diaz Diaz
Subject: Re: A suggestion to add to gnu ed: command line option to start on line foo or bar.
Date: Tue, 28 Feb 2023 17:18:04 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14

John Cowan wrote:
In addition I have also implemented
+?pattern to set the current line to the *last* line matching the pattern.

Good feature; it is also present in 'ex'.

I took the idea from GNU nano. I have never used 'ex' and all the information I have about 'ex' comes from its POSIX page, which does not seem to mention +n, +/pattern, or +?pattern.

But I would like to know what do you think it should be the behavior when
there is no match for 'pattern'. I have made ed to immediately exit with
error status 1, but I can change that behavior if something better (and
not misleading) is suggested.

I think you should in that case print "?" and go on, as it is mostly just a
convenience, and the intention to edit the file is clear.  This is
equivalent to what 'ex' does.

However, this behavior is not so good in a script.  I think therefore you
should add a command-line option -e (long form: --errexit), like the shell
option, which causes termination with error status 1 when *any* error is
detected.

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.

I have just uploaded ed-1.20-pre1 with these changes implemented. Please test it and tell me what do you think.
http://download-mirror.savannah.gnu.org/releases/ed/ed-1.20-pre1.tar.lz

Best regards,
Antonio.



reply via email to

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