#!/bin/sh
#

filename="/tmp/kabu.txt"
mysqlpass="hogehoge"

datej=`/bin/date +%Y%m%d`
timej=`/bin/date +%H%M%S`

#
# 000001.SS
#
name="000001.ss"
wget --quiet -O $filename "http://finance.cn.yahoo.com/q?s=000001.ss"
nedan=`grep -A 1 "(000001.ss)" $filename | grep "new_price" | \
sed -e s/" "//g | sed -e s/"<"/" "/g | \
sed -e s/">"/" "/g | awk '{print $2}'`

echo $name $nedan

/usr/local/bin/mysql kabu -u root --password=$mysqlpass -e \
"insert into toushin \
(bunrui,name,date,time,kagaku) values \
('ETF','$name',$datej,$timej,$nedan)"