ptyfork
2018-12-19 14:10:33 +08:00
把下面内容写到 ~/.profile
```
function tmc() {
before=$(df -hl / |awk '{print $3}' |tail -n1)
count=0
for snapshot in $(tmutil listlocalsnapshots /|awk -F. '{print $4}');do
let 'count++'
echo "delete snapshot $snapshot"
tmutil deletelocalsnapshots $snapshot;
done
after=$(df -hl / |awk '{print $3}' |tail -n1)
if [[ $count -ne 0 ]]; then
echo "Total $count snapshot(s) deleted, Size change: $before ===> $after"
else
echo "No snapshot deleted"
fi
}
```
然后打开终端 执行 tmc