diff --git a/TODO.txt b/TODO.txt index efb83e8..0e1dbc4 100644 --- a/TODO.txt +++ b/TODO.txt @@ -3,17 +3,21 @@ Doc Notes --------- +- Can be run as a freestanding program or loaded into + current shell context as a callable function. + +- -dd is effective immediately upon reading command line so + you can clean multiple graveyards with: + + /trm.sh -g ./foo -d -g ./baz -d + +- Options processed in l-r order. For example + Note difference between -vd and -dv- + - Note that symlinks are not expanded but that targets accessed via symlinks are stored to canonical path. - Test mode has no effect on -d which always works -- If -d is effective immediately upon reading command line so - you can clean multiple graveyards with: - - /trm.sh -g ./foo -d -g ./baz -d - -- Note difference between -vd and -dv - - Note differences between how serial numbers are appended - on directories vs. files. Use of find to overcome this. + on directories vs. files. diff --git a/trm.sh b/trm.sh index c5611f5..b5a64ee 100755 --- a/trm.sh +++ b/trm.sh @@ -27,6 +27,7 @@ OPERATOR="mv" # Can be overriden with -c option SERIALNO="Yes" # Generate serial numbers TESTMODE="" + USAGE="" VERBOSE="" while getopts ${OPTLIST} opt @@ -74,7 +75,7 @@ ;; *) - echo "usage: trm.sh -${OPTLIST} [file|directory] ..." + USAGE="Yes" exit 1 ;; esac @@ -154,6 +155,11 @@ } -# Uncomment to invoke as a free standing utility -trm "$@" +# Run now if invoked directly on the command line. (Otherwise, we're +# just loading the function above into the current shell context.) + +if [ $(basename "$0") = "trm.sh" ] +then + trm "$@" +fi