Bashwatch.sh -rwxr-xr-x 357 B
1#!/bin/sh
2
3BUILD_CMD="$1"
4
5_do_build() {
6 $BUILD_CMD && {
7 echo -e "\033[32;1;4mSuccess\033[0m"
8 } || {
9 echo -e "\033[31;1;4mFailure\033[0m"
10 }
11}
12
13_do_build
14inotifywait -m -e close_write,moved_to --include '.*go$' --format %e/%f . | \
15while IFS=/ read -r events file; do
16 echo "file $file modified, rebuilding"
17 _do_build
18done