1. ### TO DO: Check if source directory is given as parameter, exit status 1 on error 2. ### TO DO: Check if source is a directory, exit istatus 2 on error 3. 4. # Check the source directory is absolute or relative-to-home, exit on error 5. echo "$1" | grep "^/" > /dev/null 6. if [ "$?" -ne 0 ] 7. then 8. echo "Source must be an absolute or relative-to-home path" 9. exit 1 10. else 11. echo "Has to be relative path" 12. exit 2 13. fi 14. 15. if [ "$?" -le 0 ] 16. then 17. echo "Checking if it is relative" 18. exit 3 19. fi 20. 21. # Set the destination directory to ~/public_html if not given as argument 22. test "$#" -lt 2 && set $1 ~/public_html 23. 24. # Create the destination directory if it does not exist 25. # Exit with a status code 5 if directory cannot be created 26. test -e $2 || mkdir $2 || exit 5 27. 28. ## TO DO: Create the thumbnail directory if it does not exist 29. mkdir -p ~public_html/picreporter/thumbnail 30. ### TO DO: Determine the report file name based on the source directory name and current date 31. ### The report name and thumbnail directory must follow this pattern: source-%d-%m 32. ### for example, for pictures in /home/you/pictures, the file name will be: pictures-%d-%m 33. ### HINT: Use sed to extract the directory name from the path and combine it with date command output 34. 35. # Create the beginning of the summary page and write it to the summary file 36. ### TO DO: Correct the report file name below 37. cat << TOP > $2/picreporter.html 38. 39. 40. 41.
42." >> $2
77.
echo " > $2
78.
echo " src=\"http://www.w3.org/Icons/valid-xhtml10\"" >> $2
79.
echo " alt=\"Valid XHTML 1.0 Transitional\" height=\"31\" width=\"88\" />" >> $2
80.
echo "" >> $2
81.
echo "
" >> $2
85.
echo " " >> $2
86.
echo " > $2
87.
echo " src=\"http://jigsaw.w3.org/css-validator/images/vcss\"" >> $2
88.
echo " alt=\"Valid CSS!\" />" >> $2
89.
echo " " >> $2
90.
echo "