view_attachment.sh file for mutt on OSX. Tweaked from others available on the net to handle filenames with multiple dots in them, as well as correctly parsing the output of `file -bi` when a type is not specified.
✓ Published0🌍 Public
XXXX
Last edited Jun 16, 2012
Created on Jun 16, 2012
This script shows how to automate email attachment viewing on macOS by copying a file to a temporary directory and opening it with the default application or a specified one. It uses the `file -bi` command to discern the MIME type when none is given, then reconstructs the filename with the proper extension. The code relies on standard shell utilities (`basename`, `sed`, `cp`) and the macOS `open` command, with optional `open -a` for a chosen app. Debug output is written to `/tmp/mutt_attach/debug` when enabled.
AI-generated description