Skip to content

Instantly share code, notes, and snippets.

@komasaru

komasaru/metar.sh

Last active Jan 28, 2019
Embed
What would you like to do?
Bash script to get a METAR information.
#!/bin/bash
# 引数(ICAO コード)不正なら終了
if [[ ! "$1" =~ [0-9A-Z]{4} ]]; then
echo "Wrong argument!"
exit
fi
# URL("decode" データ)(以下のどちらか)
URL="http://weather.noaa.gov/pub/data/observations/metar/decoded/"
#URL="ftp://tgftp.nws.noaa.gov/data/observations/metar/decoded/"
# METAR 取得(以下のどちらか)
wget -q -O - "${URL}${1}.TXT"
#curl "${URL}${1}.TXT"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.