diff --git a/TODO.txt b/TODO.txt index f966c5e..c9afa69 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,4 +1,3 @@ -- Make test mode default and provide execute as an option - Handle filenames and destinations with spaces in them - Make serial number processing consistent across BSD and Linux - Make serial number postfix consistent across dirs and files diff --git a/trm.sh b/trm.sh index f1ed181..9ddb841 100755 --- a/trm.sh +++ b/trm.sh @@ -4,7 +4,9 @@ # All Rights Reserved # Permission granted for the free use of this program without restriction -export GRAVEYARD="${HOME}/.graveyard" +GRAVEYARD="${HOME}/.graveyard" +TESTING="Running in test mode ..." + mkdir -p $GRAVEYARD # This function is called at the bottom of this file or it can @@ -16,9 +18,9 @@ # Parse command line args OPERATOR="mv" # Can be overriden with -c option - OPTLIST='cdg:tsv' # List of all legal command line options + OPTLIST='cdg:tsvx' # List of all legal command line options OPTIND=1 # getopts may have been previously used in this context - TESTMODE="" + TESTMODE=${TESTING} VERBOSE="" while getopts ${OPTLIST} opt @@ -48,7 +50,7 @@ # Don't do anything, just show what you would do t) - TESTMODE="testmode" + TESTMODE=${TESTING} ;; # Be noisy @@ -56,6 +58,11 @@ VERBOSE="-v" ;; + # Actually execute + x) + TESTMODE="" + ;; + *) echo "usage: trm.sh -${OPTLIST} [file|directory] ..." exit 1 @@ -99,6 +106,7 @@ if [ -n "${TESTMODE}" ] then + echo ${TESTMODE} echo ${CMD} else mkdir -p ${DESDIR}