| |
---|
| | { |
---|
| | echo "trm.sh ${VERSION} - Copyright (c) ${COPYRIGHT} , TundraWare Inc. All Rights Reserved." |
---|
| | echo "http://www.tundraware.com/Software/trm" |
---|
| | echo "" |
---|
| | echo "Usage: trm.sh -cehinstvx -g graveyard [file|dir] ..." |
---|
| | echo "Usage: trm.sh -Vcdhistvx -g graveyard [file|dir] ..." |
---|
| | echo " where," |
---|
| | echo " -V display version control commit ID" |
---|
| | echo " -c copy targets to graveyard, don't remove them" |
---|
| | echo " -e empty the current graveyard (permanent removal)" |
---|
| | echo " -d empty the current graveyard (permanent removal)" |
---|
| | echo " -h display this help screen" |
---|
| | echo " -g graveyard use named graveyard instead of default" |
---|
| | echo " -i interactive removal/copy" |
---|
| | echo " -n noisy output - verbose mode" |
---|
| | echo " -s don't generate serial number suffixes" |
---|
| | echo " -t test mode, just show what would be done" |
---|
| | echo " -v display version control commit ID" |
---|
| | echo " -v noisy output - verbose mode" |
---|
| | echo " -x execute, overrides previous -t" |
---|
| | } |
---|
| | |
---|
| | |
---|
| |
---|
| | { |
---|
| | |
---|
| | # Parse command line args |
---|
| | |
---|
| | OPTLIST='ceg:hinstvx' # List of all legal command line options |
---|
| | OPTIND=1 # in case getopts was previously used in this context |
---|
| | OPTLIST='Vcdg:histvx' # List of all legal command line options |
---|
| | OPTIND=1 # in case getopts was previously used in this context |
---|
| | |
---|
| | # Defaults |
---|
| | |
---|
| | INTERACTIVE="" |
---|
| | OPERATOR="mv" # Can be overriden with -c option |
---|
| | SERIALNO="Yes" # Generate serial numbers |
---|
| | OPERATOR="mv" # Can be overriden with -c option |
---|
| | SERIALNO="Yes" # Generate serial numbers |
---|
| | TESTMODE="" |
---|
| | VERBOSE="" |
---|
| | |
---|
| | while getopts ${OPTLIST} opt |
---|
| | do |
---|
| | case $opt |
---|
| | in |
---|
| | |
---|
| | # Print git commit ID |
---|
| | V) |
---|
| | echo ${GITID} |
---|
| | ;; |
---|
| | |
---|
| | # Copy, don't move, targets to graveyard |
---|
| | c) |
---|
| | OPERATOR="cp -pr" |
---|
| | ;; |
---|
| | |
---|
| | # Empty the graveyard |
---|
| | e) |
---|
| | d) |
---|
| | if [ -z "${TESTMODE}" ] |
---|
| | then |
---|
| | rm -rf ${VERBOSE} ${GRAVEYARD}/* ${GRAVEYARD}/.[-z]* |
---|
| | fi |
---|
| |
---|
| | i) |
---|
| | INTERACTIVE="Yes" |
---|
| | ;; |
---|
| | |
---|
| | # Be noisy |
---|
| | n) |
---|
| | VERBOSE="-v" |
---|
| | ;; |
---|
| | |
---|
| | # Turn of serial number generation |
---|
| | s) |
---|
| | SERIALNO="" |
---|
| | ;; |
---|
| |
---|
| | t) |
---|
| | TESTMODE=${TESTING} |
---|
| | ;; |
---|
| | |
---|
| | # Print git commit ID |
---|
| | # Be noisy |
---|
| | v) |
---|
| | echo ${GITID} |
---|
| | VERBOSE="-v" |
---|
| | ;; |
---|
| | |
---|
| | # Actually execute |
---|
| | x) |
---|
| |
---|
| | |