1. #!/usr/bin/env bash
  2. echo "looking for prior status.."
  3. sleep 1
  4. if [ -f tmp/old ];
  5. then echo "status found, previous contents:";
  6. sleep 1
  7. else echo "status not found, creating base - current contents:";
  8. sleep 1
  9. ls images > tmp/old;
  10. fi
  11. old=$(cat tmp/old)
  12. echo $old
  13. sleep 1
  14. echo ""
  15. echo "searching for new files"
  16. sleep 1
  17. new=$(find images/ -newer tmp/old | sed '1d')
  18. echo "new file/s found:"
  19. sleep 1
  20. echo $new
  21. sleep 1
  22. path=$new
  23. name=$(ls images | grep new)
  24. echo ""
  25. echo "creating new link;"
  26. sleep 1
  27. link='<ul><li><a href='$path'>'$name'</a></li></ul>'
  28. echo $link
  29. echo ""
  30. sleep 1
  31. echo "adding link to test.html:"
  32. sleep 1
  33. echo ""
  34. sed '/navbar/a '$link'' test.html