During today's Austin Group meeting (the folks working on POSIX), we noticed an inconsistency in GNU ed when compared to other implementations. It seems that ALL implementations we tested allow 'q' to quit immediately after an 'e' that failed because the buffer still has unwritten modifications:
$ echo one > 1 $ ed 1 4 s/o/o/ e ? q $ We then tried to figure out what other commands, if any, can be used in between notification that a buffer was modified and a followup attempt to quit. On MacOS, 'h' does not count as an intervening command: $ ed 1 4 s/o/o/ e ? h Warning: file modified q $ But with GNU ed, the mere use of 'h' restarts the modified buffer cycle: $ ed 1 4 s/o/o/ e ? h Warning: buffer modified q ? q $ Logically, however, the 'h' command exists to tell me why I just got '?' as output; and doesn't seem like it should be modifying the buffer at all, so in this case, the MacOS behavior made more sense. -- Eric Blake, Principal Software Engineer Red Hat, Inc. Virtualization: qemu.org | libguestfs.org