Browse Source

Fix issues with spaces and special characters in filenames

Samuel W. Flint 1 year ago
parent
commit
98c15bbcc1
1 changed files with 2 additions and 2 deletions
  1. 2 2
      lpremote

+ 2 - 2
lpremote

@@ -17,14 +17,14 @@ fi
 
 FILE=$1
 shift
-BASE_FILE_NAME=$(basename ${FILE})
+BASE_FILE_NAME=$(basename "${FILE}" | tr ' ()' '___')
 
 if [ ! -e "$FILE" ] ; then
     echo "$FILE does not exist." >&2
     exit 1
 fi
 
-scp ${FILE} "${REMOTE_PRINT_HOST}:${REMOTE_PRINT_PATH}${BASE_FILE_NAME}"
+scp "${FILE}" "${REMOTE_PRINT_HOST}:${REMOTE_PRINT_PATH}${BASE_FILE_NAME}"
 
 if [ $? -eq 0 ] ; then
     ssh "$REMOTE_PRINT_HOST" -t "lp $@ ${REMOTE_PRINT_PATH}${BASE_FILE_NAME}"