#!/bin/sh # minbox [OTHERBOX] [N] - threaded view of unseen and flagged and N most recent case "$1" in "") box=~/Mail/INBOX ;; [Ss]ent) box=~/Mail/'[Gmail].Sent Mail' ;; */*) box=$1 ;; *) box=~/Mail/$1 ;; esac n=${2:-0} store=cat [ -t 1 ] && store="mseq -S" { mlist -s "$box" mlist -F "$box" if [ "$n" -gt 0 ]; then msort -Mr "$box" | head -n "$n" fi } | mthread | $store | mscan