Qiita初投稿です. 突然ですが,Macをスタバでドヤリングしているときに,突然Wifiが使えなくなることありませんか? Wifiのアイコンは接続されていると言っているのに,ネットに繋がらない😢 一時的な解決方法は,WifiをOFF/ONしてもう一回つなぎ直すわけですが,これを自動化するスクリプトを書きました. #! /bin/sh while [ $? == 0 ] do ping -c 1 8.8.8.8 while [ $? == 0 ] do sleep 1s ping -c 1 8.8.8.8 done networksetup -setairportpower en0 off networksetup -setairportpower en0 on sleep 20s done