class_management_system

Senior Project - Spring 2019
Log | Files | Refs | README

archiver.sh (659B)


      1 #!/bin/bash
      2 # The mighty archiver
      3 
      4 TIMESTAMP=$(date +%Y%m%d%H%M%S)
      5 EMPLOYEE=""
      6 
      7 # Specify document type
      8 # -s : cover [s]heet
      9 # -l : [l]ibrary form
     10 # -t : [t]emplate
     11 # -p : [p]rogram guide
     12 # -c : [c]onsult letter
     13 # -n : uploader last [n]ame
     14 
     15 while getopts ":n:f:alspc" opt
     16 do
     17     case "${opt}" in
     18         n) EMPLOYEE=${OPTARG};;
     19         f) FILE=${OPTARG};;
     20         a) DOCTYPE="Assessement_Form";;
     21         l) DOCTYPE="Lib_Form";;
     22         s) DOCTYPE="Supporting_Doc";;
     23         p) DOCTYPE="Pgrm_Guide";;
     24         c) DOCTYPE="Consult_Letter";;
     25     esac
     26 done
     27 shift $((OPTIND -1))
     28 
     29 NEWFILE=$EMPLOYEE\_$DOCTYPE\_$TIMESTAMP.pdf
     30 
     31 mv $FILE $NEWFILE
     32 echo $NEWFILE
     33 
     34 exit 0