summaryrefslogtreecommitdiff
path: root/bin/mw
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2021-09-23 19:56:58 -0400
committerLuke Smith <luke@lukesmith.xyz>2021-09-23 19:56:58 -0400
commitb6f0bd44267ea5a5f46ab27d4786ca72ae3511cd (patch)
treec4e99b976cb94e90316f7324b4a9cb2adb5bcc2c /bin/mw
parenta3fc13e5ce54cd8d0e139e338ac75370e26c9184 (diff)
more computationally efficient idnum discovery
Diffstat (limited to 'bin/mw')
-rwxr-xr-xbin/mw8
1 files changed, 3 insertions, 5 deletions
diff --git a/bin/mw b/bin/mw
index 8adb0b9..01bf86b 100755
--- a/bin/mw
+++ b/bin/mw
@@ -227,11 +227,9 @@ getboxes() { if [ -n "${force+x}" ] ; then
mailboxes="$(echo "$info" | grep -v HasChildren | sed "s/.*\" //;s/\"//g" | tr -d '\r')"
fi
[ "$type" = "pop" ] && mailboxes="INBOX"
- getaccounts
- usednums="$(grep -o "^macro.* i[0-9]\+ " "$muttrc" | grep -o "[0-9]" | sort -u)"
- for x in 1 2 3 4 5 6 7 8 9; do
- echo "$usednums" | grep -q "$x" ||
- { export idnum="$x"; break ;}
+ for x in $(sed -n "/^macro.* i[0-9] / s/\(^macro.* i\| .*\)//gp " $muttrc | sort -u; echo 0); do
+ idnum=$((idnum + 1))
+ [ $idnum -eq $x ] || break
done
toappend="mailboxes \`mdir=$maildir/$fulladdr/; find \$mdir -mindepth 1 -type d -name cur | sed -e 's:/cur\$:\":' -e \"s:\$mdir:\\\"=:\" | sort | tr '\\\n' ' '\`"
IFS='