while :; do clear; your_command; sleep 2; done
基于此你可以实现一个watch.sh脚本来实现watch
#!/bin/bash
# usage: watch.sh <your_command> <sleep_duration>
while :;
do
clear
date
$1
sleep $2
done
参考资料:
https://stackoverflow.com/questions/9574089/os-x-bash-watch-command