Press "Enter" to skip to content

MAC OS模拟Linux watch命令

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

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注