X-Git-Url: https://git.madduck.net/etc/mutt.git/blobdiff_plain/a83d50d5a64488deb3796bbd0ca0a03b0516cc77..7013dfe93a05082153f79eca6c9e5c05b54d9d50:/.config/mutt/filter-proxy diff --git a/.config/mutt/filter-proxy b/.config/mutt/filter-proxy new file mode 100755 index 0000000..e0b1ad2 --- /dev/null +++ b/.config/mutt/filter-proxy @@ -0,0 +1,31 @@ +#!/bin/sh +# +# filter-proxy - enable filters to work on real files (using tmpfiles) +# +# Copyright © 2008 martin f. krafft +# Released under the terms of the Artistic Licence 2.0 +# +set -eu + +cmd= +file= +while [ -n "${1:-}" ]; do + if [ -z "${2:-}" ]; then + file="$1" + else + case "$1" in + *' '*) cmd="$cmd '$1'";; + *) cmd="$cmd $1";; + esac + fi + shift +done + +TMPFILE="$(mktemp --tmpdir proxy.XXXXXXXXXX)" +trap "rm -f $TMPFILE" 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15 + +eval $cmd <"$file" >$TMPFILE +cat $TMPFILE >"$file" + +rm -f $TMPFILE +trap - 0 1 2 3 4 5 6 7 8 10 11 12 13 14 15