From 68319d2b551dfd76d7a72de0fbc4bdd98e2d303c Mon Sep 17 00:00:00 2001 From: coderkun Date: Sun, 12 Sep 2021 20:54:52 +0200 Subject: [PATCH] mail-count: Add sh version Add POSIX compliant sh version of the mail-count script. Additionally add comments to the bash version. --- mail-count.bash | 4 ++++ mail-count.sh | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 mail-count.sh diff --git a/mail-count.bash b/mail-count.bash index 2e7ae76..a6bd394 100755 --- a/mail-count.bash +++ b/mail-count.bash @@ -1,11 +1,15 @@ #!/bin/bash +# Count the number of unread emails and return the count in the i3/sway bar +# format. + # Settings MAILDIRNEW="$HOME/Dokumente/eMails/*/INBOX/new/" # Count new mails MAILNEW="$(find $MAILDIRNEW -type f | wc -l)" +# Print count in i3/sway bar format echo $MAILNEW echo $MAILNEW [ ${MAILNEW} -ge 1 ] && exit 33 diff --git a/mail-count.sh b/mail-count.sh new file mode 100755 index 0000000..4ff49d1 --- /dev/null +++ b/mail-count.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +# Count the number of unread emails and return the count in the i3/sway bar +# format. + +# Settings +MAILDIRNEW="$HOME/Dokumente/eMails/*/INBOX/new/" + +# Count new mails +MAILNEW="$(find $MAILDIRNEW -type f | wc -l)" + +# Print count in i3/sway bar format +echo $MAILNEW +echo $MAILNEW +[ ${MAILNEW} -ge 1 ] && exit 33 + +exit 0