#!/bin/sh -u # Answer file: Exercise #4 - exercise04script.sh # -Ian! D. Allen - idallen@idallen.ca # set and export standard shell search path, friendly umask # PATH=/bin:/usr/bin ; export PATH umask 022 LC_COLLATE=C ; export LC_COLLATE # The README.txt file should be copied here as comments. # # I've grouped questions together in the comments below, to make the # file more readable. # 6. Remove recursively any existing directory and contents. # 7. Create a new, empty directory. # 8. Make the new directory our current dir to make pathnames shorter. # 9. Show our current directory. # 10. Copy all the image fragment files into the new directory. # rm -rf image4 mkdir image4 cd image4 pwd cp ~alleni/image/* . # 11. Rename the incorrectly-named files to have their correct names. # mv aa mystery\ image\ fragment\ aa mv bf mystery\ image\ fragment\ bf mv "dt " mystery\ image\ fragment\ dt mv go mystery\ image\ fragment\ go mv " gw" mystery\ image\ fragment\ gw # 12. Concatenate all 179 fragment files into one file named image.jpg # 13. Remove all the file fragments, leaving only the image.jpg file. # cat mystery* >image.jpg rm -f mystery* README* # 14. Display the permissions, size, and checksum of the image.jpg file. # ls -l image.jpg sum image.jpg # To display this image on your screen in Linux: # display image.jpg