#!/usr/bin/env sh : \ && f="${1?missing filename}" && shift \ && for e in "$@" \ ;do : \ && cp "$f" "$f.bak" && sed -i -e "$e" "$f" \ && { diff -q "$f" "$f.bak" >/dev/null; [ $? = 1 ] ;} \ || { printf >&2 '\033[91mfailed to apply sed:\033[m\n%s\n' "$e"; exit 1 ;} \ && rm "$f.bak" || exit \ ;done \ ;