LoginSignup
2
1

More than 5 years have passed since last update.

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

Posted at

いきなり本題

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

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
2
1
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1