Skip to content

Instantly share code, notes, and snippets.

@faizzed
Created March 9, 2020 12:53
Show Gist options
  • Save faizzed/20563d5144b82d9ec33617c8124a2d9a to your computer and use it in GitHub Desktop.
Save faizzed/20563d5144b82d9ec33617c8124a2d9a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
if [ "$1" == "" ]; then
printf "First argument should be filename.."
exit
fi
file="$1"
### Set initial time of file
LTIME=`stat -c %Z "$file"`
while true
do
ATIME=`stat -c %Z "$file"`
if [[ "$ATIME" != "$LTIME" ]]
then
go run "$file";
printf "===============================\n"
LTIME=$ATIME
fi
sleep 1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment