Skip to content

Waits for one of a number of files to be changed, then exits

Notifications You must be signed in to change notification settings

Mikoangelo/file-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

File Monitor

Waits for one of a number of files to be changed, then exits. Simple as that. Mac OS X only (probably works for pretty old versions, even).

Usage

monitor <file> …

To try it out, this will do:

$ touch monitor-this.txt
$ (monitor monitor-this.txt; echo "Monitor exited.") & # Run in background.
$ # Wait a while
$ touch monitor-this.txt
Monitor exited.
$

It's useful particularly as the condition in a while loop around a frequent command. See below.

Depend — an added bonus

Give depend a command to run, and touch away; the command will be repeated every time a file changes.

I recommend depend 'rake spec' spec/* for ad-hoc spec creation.

To come

I hope to expand this to include directory monitoring. I may have to break into Obj-C for it. Some day it will happen, lest a kind soul lend a helping fork before then.

About

Waits for one of a number of files to be changed, then exits

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages