diff --git a/ed.c b/ed.c index ede4c51..3775b59 100644 --- a/ed.c +++ b/ed.c @@ -795,7 +795,8 @@ dowrite(const char *fname, int trunc) if (r) error("input/output error"); strcpy(savfname, fname); - modflag = 0; + if (!sh) + modflag = 0; curln = line; if (optdiag) printf("%zu\n", bytecount); diff --git a/tests/0017-ed.sh b/tests/0017-ed.sh new file mode 100755 index 0000000..26c4b29 --- /dev/null +++ b/tests/0017-ed.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +../ed -s /dev/null < /dev/null +a +1 +2 +. +w !echo +q +h +EOF