Created
August 19, 2016 15:33
-
-
Save mermshaus/8d6cba55c2bca629bdeb6d90066c647b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# marc-watchphp -- Executes a PHP script file when its content changes. | |
# | |
# Usage: $ marc-watchphp <file> | |
# | |
# Working directory MUST be file's directory. Press Ctrl-C to stop. | |
inotifywait -q -m -e close_write,moved_to --format %e/%f . | | |
while IFS=/ read -r events file; do | |
if [ "$file" = "$1" ]; then | |
date=$(date) | |
echo "+==================================================================" | |
echo "| $date" | |
echo "| \$ php -f $file" | |
echo "+==================================================================" | |
php -f "$file" | |
echo | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment