diff options
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/mbsync2mutt_mailboxes | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/mbsync2mutt_mailboxes b/bin/mbsync2mutt_mailboxes index c98e219..ccf9505 100755 --- a/bin/mbsync2mutt_mailboxes +++ b/bin/mbsync2mutt_mailboxes @@ -27,11 +27,16 @@ get_mailboxes_by_account() { } output_mailboxes_to_file() { + local tmpfile counter tmpfile="$(mktemp)" + counter=0 for account in "${!mailboxes[@]}"; do echo -e "mailboxes ${mailboxes[$account]}\n" >> "$tmpfile" + counter=$(( "$counter" + 1 )) done - mv "$tmpfile" "$output_file" + if (( "$counter" > 0 )); then + mv "$tmpfile" "$output_file" + fi } if [ $# -ne 1 ]; then |