[TUHS] Posix ed weirdness
Douglas McIlroy via TUHS
tuhs at tuhs.org
Tue Dec 16 07:55:54 AEST 2025
The ed j command joins a sequence of lines into one line and sets dot
to the result. Thus
2,4j
combines three lines and sets dot to 2. Naturally one expects
2,2j
to make no visible change to the file, but to set dot to 2.
Indeed, that's what v7 did. But Posix decrees that j "does nothing" in
this case and leaves dot at the value it had before the command.
Does anyone know why the Posix committee chose to break both the
original behavior and Kernighan's law: " 'Do nothing' gracefully"?
Doug
More information about the TUHS
mailing list