aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Kavanagh <rak@rak.ac>2020-09-11 14:50:44 -0400
committerRyan Kavanagh <rak@rak.ac>2020-09-11 14:50:44 -0400
commit0dc7b92e2b3015e0ba872a48d89af2ea7ebd5b54 (patch)
tree8e61c08540f95fea2f86679eb4d13ef4a537b148
parentAdd exclusion option (diff)
Better cope with spaces in filenames
-rwxr-xr-xptmp10
1 files changed, 7 insertions, 3 deletions
diff --git a/ptmp b/ptmp
index 125d8dc..e2446c5 100755
--- a/ptmp
+++ b/ptmp
@@ -28,11 +28,15 @@ do
done
shift `expr $OPTIND - 1`
-PAD=$(md5sum $1 | cut -f1 -d' ')
-BASE=$(basename $1)
+FILE="$@"
+
+PAD=$(md5sum "${FILE}" | cut -f1 -d' ')
+BASE=$(basename "${FILE}")
DEST_NAME="${PAD}.${BASE}${OPT_SUFFIX}"
-scp $1 "${DEST_DIR}/${DEST_NAME}"
+echo "${DEST_NAME}"
+
+scp "${FILE}" "${DEST_DIR}/${DEST_NAME}"
echo "https://rak.ac/~tmp/${DEST_NAME}"