To run a command similar to the Linux watch
command on Mac OSX, do the following:
while :; do your_command; done
For example, the following will check the disk usage for the current directory via `du' every two seconds. The `echo -ne "\r"' causing the line to write over itself replacing the existing line.
while :; do echo -ne " "$(du -s .)"\r"; sleep 2s; done
2 comments
See also
watch_file()
command in https://github.com/dot-star/dot-star/blob/master/bash/.aliases.sh#L439See also https://www.darklaunch.com/watch-files-and-run-a-command
Leave a Reply