diff options
author | Luke Smith <luke@lukesmith.xyz> | 2022-12-21 18:07:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-21 18:07:09 +0000 |
commit | 79ce5f9f793f1eda66944ba51c2692baf93051d2 (patch) | |
tree | b011092cc82bcf73eed7f981c974c1a259af2609 | |
parent | 499e2b17980d1024e23a874dc2130df79acc842e (diff) | |
parent | f6b5806af9489d4663b849b4360e314b0709d856 (diff) |
Merge pull request #895 from Shane-XB-Qian/pr_make_o_O_macro_work
fix: make o and O macro work and really sync multiple/individual accounts
-rwxr-xr-x | bin/mailsync | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/bin/mailsync b/bin/mailsync index 1855ded..26e71ea 100755 --- a/bin/mailsync +++ b/bin/mailsync @@ -77,16 +77,27 @@ if [ "$#" -gt "0" ]; then done accounts=$* fi -# TODO handle account passed from argument -[ -z "$accounts" ] && accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC" 2>/dev/null)" -[ -z "$pop_accounts" ] && [ -x $MPOPRC ] && pop_accounts="$(awk '/^account/ {print $2}' "$MPOPRC" 2>/dev/null)" +[ -z "$imap_accounts" ] && [ -r "$MBSYNCRC" ] && imap_accounts="$(awk '/^Channel/ {print $2}' "$MBSYNCRC" 2>/dev/null)" +[ -z "$pop_accounts" ] && [ -r "$MPOPRC" ] && pop_accounts="$(awk '/^account/ {print $2}' "$MPOPRC" 2>/dev/null)" # Parallelize multiple accounts -for account in $accounts; do +for account in $imap_accounts; do + if [ -n "$accounts" ]; then + for tmp_ac in $accounts; do + [ "$tmp_ac" = "$account" ] && syncandnotify "imap" & + done + continue + fi syncandnotify "imap" & done for account in $pop_accounts; do + if [ -n "$accounts" ]; then + for tmp_ac in $accounts; do + [ "$tmp_ac" = "$account" ] && syncandnotify "pop" & + done + continue + fi syncandnotify "pop" & done |