#!/bin/sh WATCH_FILE="$1" shift 1; WATCH_DIR=`dirname "$WATCH_FILE"` WATCH_FILE=`basename "$WATCH_FILE"` inotifywait -m -e close_write,moved_to,create $WATCH_DIR | while read -r directory events filename; do if [ "x$filename" = "x$WATCH_FILE" ]; then ( exec "$@" ); fi; done;