On 2023-02-27 13:16:56 -0500 John Cowan wrote: ┃ 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.
Traditionally, reading scripts from piped input suppressed exit-on-error behavior. For instance, the following script fails prematurely: ed -vs <<EOF a hello . s/x a world . wq o.tmp EOF and no file 'o.tmp' is created. But by piping it: cat <<EOF | ed -vs a hello . s/x a world . wq o.tmp EOF the script completes and the file 'o.tmp' is created with contents 'hello\nworld\n'. The failed substitution is still reported, but the exit-on-error behavior is suppressed. This has been supported by ed for nearly 50 years. Adding a new flag doesn't provide any new functionality, but it does break portability. Having said that, if Antonio chooses to add an explicit flag, please let it be something other than `-e', which is already used by sed to introduce a script on the command line. I use this flag in the same manner in my implementation of ed and hope that it might eventually be adopted by GNU ed (see:https://github.com/slewsys/ed#script-flags). -AM