mblaze/msetseq
2016-07-20 19:21:53 +02:00

14 lines
303 B
Bash
Executable File

#!/bin/sh -e
# msetseq [-a] - store/append stdin as santoku seq (can be used as filter)
: ${MAILMAP:=~/.santoku/map}
if [ "$1" = -a ]; then
cat ${MAILMAP} - >"${MAILMAP}-"
else
cat >"${MAILMAP}-"
fi
mv "${MAILMAP}" "${MAILMAP}.old" || true
mv "${MAILMAP}-" "${MAILMAP}"
[ -t 1 ] || cat "${MAILMAP}"