24 lines
457 B
Bash
Executable file
24 lines
457 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# "coc" stands for "compile on change" and runs the supplied compile
|
|
# command when the given list of files is changed.
|
|
#
|
|
# coc [command] [fileToCompile] [filesToWatch]
|
|
#
|
|
# If no explicit list of files to watch is given, fileToCompile is
|
|
# watched.
|
|
|
|
command=$1
|
|
file=$2
|
|
shift 2
|
|
watchedFiles=$@
|
|
|
|
if [ -z "$watchedFiles" ] ; then
|
|
watchedFiles=$file
|
|
fi
|
|
|
|
while true ; do
|
|
date
|
|
inotifywait -e modify $watchedFiles
|
|
$command $file
|
|
done
|