From a0d9d84d424efc86f1ab78c88c479a60b7ed841a Mon Sep 17 00:00:00 2001 From: Ben Morrison Date: Wed, 17 Jun 2020 02:03:10 -0400 Subject: testing for OS to improve portability of new post notification --- check_new_clinte_posts.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/check_new_clinte_posts.sh b/check_new_clinte_posts.sh index 806c6c7..9086b3a 100755 --- a/check_new_clinte_posts.sh +++ b/check_new_clinte_posts.sh @@ -1,10 +1,18 @@ #!/bin/sh -LOCAL_FILE="$HOME/.clinte.json" -LOCAL_HASH=$(sha256sum "$LOCAL_FILE" 2>/dev/null | cut -d' ' -f1) +OS=$(uname) +LOCAL_FILE="$HOME/.clinte.json" DBFILE="/usr/local/clinte/clinte.json" -DBFILE_HASH=$(sha256sum "$DBFILE" | cut -d' ' -f1) + +if [ $OS = "Linux" ] +then + LOCAL_HASH=$(sha256sum "$LOCAL_FILE" 2>/dev/null | cut -d' ' -f1) + DBFILE_HASH=$(sha256sum "$DBFILE" | cut -d' ' -f1) +else + LOCAL_HASH=$(sha256 "$LOCAL_FILE" 2>/dev/null | cut -d' ' -f1) + DBFILE_HASH=$(sha256 "$DBFILE" | cut -d' ' -f1) +fi if [ "$LOCAL_HASH" != "$DBFILE_HASH" ] then -- cgit 1.4.1-2-gfad0