Skip to content

Instantly share code, notes, and snippets.

@clyfish
Created February 23, 2017 06:09
Show Gist options
  • Save clyfish/b9f83f0f56a22599c04396e373160217 to your computer and use it in GitHub Desktop.
Save clyfish/b9f83f0f56a22599c04396e373160217 to your computer and use it in GitHub Desktop.
#!/bin/bash
# 金融指数:s_sz399240
# 中证500:s_sz399905
# 中证白酒:s_sz399997
while :
do
echo -n "| `date +%H:%M` | "
output=`curl -s "http://hq.sinajs.cn/list=s_sh000001,s_sh000300,s_sz399905,s_sz399001,s_sz399006,s_sh000016" | iconv -f gbk -t utf8 | sed 's/中证 500/中证500/' | awk -F'[",]' 'BEGIN{ORS=" | "}{print $2,$3,$5"%"}'; curl -s "http://hq.sinajs.cn/?list=rt_hkHSI" | iconv -f gbk -t utf8 | awk -F'[",]' 'BEGIN{ORS=" | "}{print $3,$8,$10"%"}'`
title=`echo "$output" | awk '{print "上"$3"沪"$7"中"$11"恒"$27}'`
echo $output
echo -ne '\033]2;'$title'\007'
sleep 60
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment