From 325fd23aa6bb5264d31dd9971bcab02d27fdb110 Mon Sep 17 00:00:00 2001 From: ev-agelos Date: Sat, 23 Jun 2018 10:26:06 +0200 Subject: [PATCH] fix pinging ip if grep returns multiple ips --- etc/mailsync.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/etc/mailsync.sh b/etc/mailsync.sh index 9f6f3c6..69400f5 100755 --- a/etc/mailsync.sh +++ b/etc/mailsync.sh @@ -13,10 +13,10 @@ export DISPLAY=:0.0 # Settings are different for MacOS (Darwin) systems. if [ "$(uname)" == "Darwin" ] then - ping -q -t 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit + ping -q -t 1 -c 1 `ip r | grep -m 1 default | cut -d ' ' -f 3` >/dev/null || exit notify() { osascript -e "display notification \"$2 in $1\" with title \"Youve got Mail\" subtitle \"Account: $account\"" && sleep 2 ;} else - ping -q -w 1 -c 1 `ip r | grep default | cut -d ' ' -f 3` >/dev/null || exit + ping -q -w 1 -c 1 `ip r | grep -m 1 default | cut -d ' ' -f 3` >/dev/null || exit notify() { pgrep -x dunst && notify-send -i ~/.config/mutt/etc/email.gif "$2 new mail(s) in \`$1\` account." ;} fi