urls=('www.baidu.com' 'mm.yellowurl.cn' 'm.yellowurl.cn' 'http://m.yellowurl.cn/product/a.html'); for i in ${urls[@]}; do http_code=$(curl -I -s $i -w %{http_code}); echo $i status: ${http_code:9:3}; done