I want to automatically kick off a build whenever a file changes.
I've used autospec (RSpec) in Ruby and loved that.
How can this be done in bash?
I want to automatically kick off a build whenever a file changes.
I've used autospec (RSpec) in Ruby and loved that.
How can this be done in bash?
I did it with this :-
#!/bin/bash
ls -ltR > .monitor_compare1
not_changed () {
echo "No changes yet..."
}
changed () {
echo "Changed!"
# perform build
}
while true; do
ls -ltR > .monitor_compare1
diff .monitor_compare1 .monitor_compare2 >> /dev/null && not_changed || changed
cp .monitor_compare1 .monitor_compare2
sleep 1
done
But I have also read the stat command might be better/quicker!