$ cat fav
#!/bin/bash
for i in {1..7}
do
echo http://api.stackoverflow.com/1.0/users/113124/favorites?page=$i&pagesize=100
done
$ ./fav
http://api.stackoverflow.com/1.0/users/113124/favorites?page=1
http://api.stackoverflow.com/1.0/users/113124/favorites?page=3
http://api.stackoverflow.com/1.0/users/113124/favorites?page=6
http://api.stackoverflow.com/1.0/users/113124/favorites?page=5
http://api.stackoverflow.com/1.0/users/113124/favorites?page=7
http://api.stackoverflow.com/1.0/users/113124/favorites?page=4
http://api.stackoverflow.com/1.0/users/113124/favorites?page=2
$
- 爲什麼我在最後得不到
&pagesize=100
? - 另外,爲什麼結果不合理?
我不明白平行部分。即使它們在後臺執行,「i = 1」語句在「i = 2」語句之前執行,不是嗎? – Lazer 2010-09-18 17:53:12
它們是按*順序啓動的,但是,因爲它們是異步運行的,所以不能保證它們以何種順序執行'echo'commnands或finish。 – 2010-09-18 18:01:53