diff --git a/trm.sh b/trm.sh index 26c850f..bedf21e 100755 --- a/trm.sh +++ b/trm.sh @@ -152,13 +152,13 @@ # Bare symlink itelf - REALPATH=$(readlink -f $(dirname "$1")) + REALPATH=$(readlink -f $(dirname -- "$1")) if [ "${REALPATH}" = '/' ] then REALPATH="" fi - REALPATH="${REALPATH}"/$(basename "$1") + REALPATH="${REALPATH}"/$(basename -- "$1") # Process normal files and directories @@ -176,13 +176,13 @@ # Figure out absolute paths for source and destination - SRCDIR=$(dirname "${REALPATH}") + SRCDIR=$(dirname -- "${REALPATH}") if [ "${SRCDIR}" = '/' ] then SRCDIR="" fi - SRCFIL=$(basename "${REALPATH}") + SRCFIL=$(basename -- "${REALPATH}") DESDIR="${GRAVEYARD}${SRCDIR}" DESFIL="${SRCFIL}${SERIAL}" CMD="${OPERATOR} $VERBOSE '${REALPATH}' '${DESDIR}/${DESFIL}'" @@ -230,10 +230,10 @@ # just loading the function above into the current shell context.) ##### -# For some reason, bash on FreeBSD returns $0 with a leading "-" -# which breaks the logic if we don't scrub it out here. +# Login shells report $0 with a leading "-". This breaks 'basename', +# so we have to tell it not to treat the dash as an option delimiter. -if [ $(basename $(echo "$0" | sed s/^-//)) = "trm.sh" ] +if [ $(basename -- "$0") = "trm.sh" ] then trm "$@" fi diff --git a/version b/version index 048e7e1..5d9aad8 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.101 +1.102