Thus said Ralph Corderoy on Thu, 06 Jun 2024 11:15:43 +0100:
> My guess is you're imperfect in your ed-ing. :-)
Or perhaps the ed utility is poorly implemented. Man page for OpenBSD's ed:
EXIT STATUS
The ed utility exits 0 on success, and >0 if an error occurs.
Does this statement mean that there was an error during the sequence of
ed commands or does it mean that there was an error in saving?
At any rate, observe:
$ ed /tmp/foo
/tmp/foo: No such file or directory
a
foo
.
wq
4
$ echo $?
0
$ ed /tmp/foo
4
/bar
?
$a
bar
.
wq
8
$ echo $?
0
So, in my case, ed exited 0. Is this a bug in OpenBSD's ed which
claims to be "compliant with the IEEE Std 1003.1-2008 ("POSIX.1")
specification", or a bug in the man page?
Andy