Steve, For the record, a belated reply to your question: how can ed(1) mask an error from a failed search <http://lists.gnu.org/archive/html/bug-ed/2008-09/msg00000.html>.
The "documented" way is to use the global command: g/string/ In the context of scripting, ed(1) is documented to abort on errors. Historically, though, errors are masked when read via a pipe. For example: $ cat o.tmp hello world $ cat o.ed 1,$s/foo/bar/ 1,$s/hello/bye/ wq o2.tmp $ ed - o.tmp <o.ed ? $ cat o2.tmp cat: o2.tmp: No such file or directory $ cat o.ed | ed - o.tmp ? $ echo $? 2 $ cat o2.tmp bye world $ If it is important that ed(1) exit status also be zero, then the script could be written as: $ cat o2.ed g/foo/s//bar/ g/hello/s//bye/ wq o2.tmp $ rm o2.tmp $ ed - o.tmp <o2.ed $ echo $? $ cat o2.tmp bye world $ _______________________________________________ bug-ed mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-ed
