sync/mutt/.mutt/attach_fork.sh
2019-04-05 14:28:27 -04:00

14 lines
299 B
Bash
Executable File

#!/bin/sh
if (($# < 2)); then
printf "Invalid usage\nPress enter\n" >&2
read
exit 2
fi
set -xe
OLD_FILE="$1"
shift
BASENAME="$(basename "$OLD_FILE")"
NEW_FILE="$(mktemp --suffix "${BASENAME##*.}")"
cp --no-preserve=all -- "$OLD_FILE" "$NEW_FILE"
exec "$@" "$NEW_FILE" >/dev/null 2>&1 & disown