Simple image host.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324
  1. #!/bin/bash
  2. DIR="."
  3. CMD="$1"
  4. $CMD &
  5. PID=$!
  6. OLD=$(ls -R --full-time "$DIR")
  7. while :; do
  8. NEW=$(ls -R --full-time "$DIR")
  9. if [ "$OLD" != "$NEW" ]; then
  10. OLD=$(ls -R --full-time "$DIR")
  11. kill -9 "$PID" > /dev/null
  12. [ $? != "0" ] && echo "Process $PID doesn't exist."
  13. $CMD &
  14. PID=$!
  15. fi
  16. sleep 1
  17. done