cat ~/Scripts/changeAppStoreHost #!/bin/sh NewIP=`nslookup a1.phobos.apple.com 178.79.131.110 | tail -n 2 | head -n 1 | sed 's/Address\: //g'` OldHosts=`cat /etc/hosts` if [[ $OldHosts =~ phobos\.apple\.com ]] then OldIP=`grep "phobos" /etc/hosts | head -n 1 | sed "s/[ ]//g" | sed "s/a[0-9]*.phobos.apple.com//g"` sed "s/${OldIP}/${NewIP}/g" /etc/hosts > /tmp/tmpHosts sudo mv /tmp/tmpHosts /etc/hosts else for (( i = 1; i <= 2000 ; i ++ )) do echo "${NewIP} a$i.phobos.apple.com" >> /etc/hosts done fi
赞shell
[回复]