查看天气脚本

#!/bin/sh
if [ $# -eq 1 ]
then
    city=$1
elif [ $# -eq 0 ]
then
    city=beijing
else
    echo "请输入城市(拼音)" >&2
    return 1
fi
w3m -dump "http://weather1.sina.cn/?code=$city" 2> /dev/null | sed '1,/更换城市/d;/\[1\]/,$d'

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注