Earlier quoted context omitted.
>> "That doesn't help with sed -i and similar things." > Can you give an example? I don't know what you mean. Sure. The first line below is dangerous no matter what zsh does to save you from yourself. The second line is safe no matter which shell you are using, and no matter what other commands are in the pipeline: sed $SEDOPTIONS "s/$SEARCHTERM/$REPLACEMENT/g" $FILENAME cat $FILENAME | sed $SEDOPTIONS "s/$SEARCHTERM…
Yes, in-place editing with tools like sed is dangerous. But, in your own example you have a useless use of cat: cat $FILENAME | sed $SEDOPTIONS "s/$SEARCHTERM/$REPLACEMENT/g" could be replaced with: sed $SEDOPTIONS "s/$SEARCHTERM/$REPLACEMENT/g"
With the useless use of cat, that is no longer possible even if there is a typo in the SEDOPTIONS.