X-Git-Url: https://git.madduck.net/etc/neomutt.git/blobdiff_plain/a6ac44586209b9b0be5add1bef270451f3dcb677..4d1afcd5cc3e282554877a10d6be81931ef0cc03:/.config/neomutt/filter-proxy diff --git a/.config/neomutt/filter-proxy b/.config/neomutt/filter-proxy new file mode 100755 index 0000000..e0b1ad2 --- /dev/null +++ b/.config/neomutt/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