diff --git a/TODO.txt b/TODO.txt index f9ac5b8..fe19794 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,6 +1,6 @@ -- Fix copy/mv through symlink - Handle filenames and destinations with spaces in them - Make serial number postfix consistent across dirs and files +- Add -h help and usage screen Doc Notes --------- diff --git a/trm.sh b/trm.sh index df26f76..2bbcb2c 100755 --- a/trm.sh +++ b/trm.sh @@ -81,7 +81,15 @@ # Symlinks require special care if [ -L $arg ] then - REALPATH=$(readlink -f $(dirname $arg))/$arg + + # Bare symlink itelf + REALPATH=$(readlink -f $(dirname $arg)) + if [ ${REALPATH} = '/' ] + then + REALPATH="" + fi + + REALPATH=${REALPATH}/$(basename $arg) # Process normal files and directories else @@ -96,12 +104,15 @@ fi SRCDIR=$(dirname $REALPATH) + if [ ${SRCDIR} = '/' ] + then + SRCDIR="" + fi SRCFIL=$(basename $REALPATH) DESDIR=${GRAVEYARD}${SRCDIR} DESFIL="${SRCFIL}${SERIAL}" CMD="${OPERATOR} $VERBOSE '${REALPATH}' '${DESDIR}/${DESFIL}'" - if [ -n "${TESTMODE}" ] then echo ${TESTMODE}