1. 脚本 #!/bin/bash # by cnwesleywang@gmail.com # http://www.wesleywang.net GOOD=$'/e[32;01m' WARN=$'/e[33;01m' BAD=$'/e[31;01m' HILITE=$'/e[36;01m' BRACKET=$'/e[34;01m' NORMAL=$'/e[0m' Usage="${BAD}Try something like${NORMAL} /"$0 install stardict/"" if [ "$#" -lt 2 ] ; then echo "$Usage"; exit 1; fi cmdout=`apt-get $* -y --print-uris` if [ $? -ne 0 ] ; then echo "${BAD}The command you input return fail,check it:$*${NORMAL}" exit 1; fi urls=`echo $cmdout | grep -e "http[:/a-zA-Z0-9._-]*.deb" -o` for aurl in $urls do echo "${HILITE}Trying to download${NORMAL} $aurl" cd /var/cache/apt/archives && axel $aurl if [ $? -ne 0 ] ; then echo "${BAD}Download $aurl fail,Skip!${NORMAL}" fi done echo "${HILITE}Now execute the normal apt-get command!${NORMAL}" apt-get $* 2. 用法 sudo sh bin/axel-get install xxx