シェルスクリプトでLINEに天気を投稿する


いきなり本題

よくわからないけどこれで投稿出来た。

Weather Hacks
LINE Notify
jqコマンドインストール

#!/bin/bash

api=`curl -s http://weather.livedoor.com/forecast/webservice/json/v1\?city\=016010 | jq -r '.forecasts[] | select(.dateLabel == "今日").telop'`
headers={"Authorization":"Bearer"}
ACCESS_TOKEN=line_token
MSG="今日の天気は$apiです。"
curl -X POST -H "Authorization: Bearer $ACCESS_TOKEN" -F "message=$MSG" https://notify-api.line.me/api/notify