From 5e55ca9caf52ee8684f640f7b08414442554848e Mon Sep 17 00:00:00 2001 From: Shun Git Date: Sun, 5 Apr 2020 16:22:13 +0800 Subject: [PATCH] fix ifttt --- bin/ifttt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bin/ifttt b/bin/ifttt index 0b0a90f..94114f0 100755 --- a/bin/ifttt +++ b/bin/ifttt @@ -11,9 +11,7 @@ _json () { local a=$1 local b=$2 shift 2 - cat <<-EOF - {"value1":"$a","value2":"$b","value3":"$@"} - EOF + echo '{"value1":"'$a'","value2":"'$b'","value3":"'$@'"}' } if [ $# -eq 3 ]; then @@ -22,4 +20,6 @@ else data="$( _json "$(hostname)" "$(pwd)" "$@" )" fi -curl -s -H 'Content-Type: application/json' -o /dev/null -d "$data" "$API" +result="$(curl -s -H 'Content-Type: application/json' -d $data $API)" +[ "$result" = 'Bad Request' ] && exit 1 +exit 0