Skip to content

Commit a948ff5

Browse files
authored
Merge pull request #5 from d-e-s-o/topic/quoting
Fix quoting of arguments
2 parents 17bf75c + 1091727 commit a948ff5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pdf2remarkable.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ fi
7373

7474
RESTART_XOCHITL_DEFAULT=${RESTART_XOCHITL_DEFAULT:-0}
7575
RESTART_XOCHITL=${RESTART_XOCHITL_DEFAULT}
76-
if [ $1 == "-r" ] ; then
76+
if [ "$1" == "-r" ] ; then
7777
shift
7878
if [ $RESTART_XOCHITL_DEFAULT == 0 ] ; then
7979
echo Switching
@@ -87,15 +87,15 @@ fi
8787
tmpdir=$(mktemp -d)
8888

8989
# Loop over the command line arguments,
90-
# which we expect are paths to the PDF files to be transfered
91-
for pdfname in $@ ; do
90+
# which we expect are paths to the PDF files to be transferred
91+
for pdfname in "$@" ; do
9292

9393
# reMarkable documents appear to be identified by universally unique IDs (UUID),
9494
# so we generate one for the document at hand
9595
uuid=$(uuidgen)
9696

9797
# Copy the PDF file itself
98-
cp $pdfname ${tmpdir}/${uuid}.pdf
98+
cp "$pdfname" ${tmpdir}/${uuid}.pdf
9999

100100
# Add metadata
101101
# The lastModified item appears to contain the date in milliseconds since Epoch
@@ -110,7 +110,7 @@ for pdfname in $@ ; do
110110
"synced": false,
111111
"type": "DocumentType",
112112
"version": 1,
113-
"visibleName": "$(basename $pdfname .pdf)"
113+
"visibleName": "$(basename "$pdfname" .pdf)"
114114
}
115115
EOF
116116

@@ -157,7 +157,7 @@ EOF
157157
# or 72x72, segment length 16, precision 8, frames 3
158158
#
159159
# The following will look nice only for PDFs that are higher than about 32mm.
160-
convert -density 300 $pdfname'[0]' \
160+
convert -density 300 "$pdfname"'[0]' \
161161
-colorspace Gray \
162162
-separate -average \
163163
-shave 5%x5% \

0 commit comments

Comments
 (0)