diff --git a/trm.sh b/trm.sh index 9ddb841..6bf3320 100755 --- a/trm.sh +++ b/trm.sh @@ -18,9 +18,9 @@ # Parse command line args OPERATOR="mv" # Can be overriden with -c option - OPTLIST='cdg:tsvx' # List of all legal command line options + OPTLIST='cdg:tvx' # List of all legal command line options OPTIND=1 # getopts may have been previously used in this context - TESTMODE=${TESTING} + TESTMODE="" VERBOSE="" while getopts ${OPTLIST} opt @@ -43,11 +43,6 @@ GRAVEYARD=${OPTARG} ;; - # Expand symlinks - s) - SYMEXPAND="symexpand" - ;; - # Don't do anything, just show what you would do t) TESTMODE=${TESTING} @@ -76,31 +71,21 @@ for arg in $* do - # Only expand symlinks if we ask for it - + # Symlinks require special care if [ -L $arg ] then - - # Expand the symlink - if [ -n "${SYMEXPAND}" ] - then - REALPATH=$(readlink $arg) - - # Treat the symlink as a normal file - else - REALPATH=$(readlink -f $(dirname $arg))/$arg - fi + REALPATH=$(readlink -f $(dirname $arg))/$arg # Process normal files and directories else - REALPATH=$(readlink -f $arg) + REALPATH=$(readlink -f $arg) fi SRCDIR=$(dirname $REALPATH) SRCFIL=$(basename $REALPATH) DESDIR=${GRAVEYARD}${SRCDIR} - SERIAL=$(date +%Y%m%d%s%N) - DESFIL="${SRCFIL}.${SERIAL}" + SERIAL=".$(date +%Y%m%d%s%N)" + DESFIL="${SRCFIL}${SERIAL}" CMD="${OPERATOR} $VERBOSE '${REALPATH}' '${DESDIR}/${DESFIL}'"