Trying to track down which behavior is correct, is there a way to determine whether this is OpenBSD's issue or FreeBSD's? I'm not very good at reading POSIX specs for edge-cases like this.
# on OpenBSD 5.4 tim@openbsd$ echo y | sed -e 'i\ x' -e 'a\ z' xy ztim@openbsd$ uname -a OpenBSD openbsd.example.net 5.4 GENERIC.MP#2 i386 # on FreeBSD tim@freebsd$ echo y | sed -e 'i\ x' -e 'a\ z' x y z tim@freebsd$ uname -a FreeBSD freebsd.example.net 11.0-CURRENT FreeBSD 11.0-CURRENT #0 r277486: Wed Jan 21 16:31:48 UTC 2015 r...@grind.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64 It appears that OpenBSD doesn't add newlines after the content specified via i/a commands issued on the command-line unless they're explicitly added. FreeBSD does. For the record & clarity, I trimmed out the $PS2 ">" from the continued lines, and the shell in both cases is /bin/sh I can provide further details from either machine if needed. I have root on this FreeBSD box but am a guest on the OpenBSD box. If needed, I can disinter a junker from the closet and install the latest OpenBSD. -tkc