The Simplest Continuous Testing
November 26, 2012
Here's a simple bash script I use to do things to files whenever they change. It takes a command as an argument and runs that command with the name of a changed file. Many times, it's all I need to do continuous testing.
#!/bin/bash
# Requires that the inotify-tools package be installed.
wait_cmd="inotifywait -m -r --format %w%f -e modify ."
filter=$1
shift
cmd="$@"
$wait_cmd | grep --line-buffered $filter | while read file; do
clear
$cmd $file
date
done
Comments