From 07af747ef539b91ae2f4966a1281c8e026f2ceed Mon Sep 17 00:00:00 2001 From: Jon Seymour Date: Sun, 3 Dec 2017 15:27:13 +1100 Subject: [PATCH] Quote file names to better tolerate filenames with whitespace. Signed-off-by: Jon Seymour --- asc2qr.sh | 4 ++-- qr2asc.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/asc2qr.sh b/asc2qr.sh index a10e3ef..7bba162 100755 --- a/asc2qr.sh +++ b/asc2qr.sh @@ -40,8 +40,8 @@ if [ $# -ne 1 ]; then fi asc_key=${1} -if [ ! -f ${asc_key} ]; then - echo "key file not found: ${asc_key}" +if [ ! -f "${asc_key}" ]; then + echo "key file not found: '${asc_key}'" exit 1 fi diff --git a/qr2asc.sh b/qr2asc.sh index 43f27ff..9aadda8 100755 --- a/qr2asc.sh +++ b/qr2asc.sh @@ -37,13 +37,13 @@ fi chunks=() index=1 for img in "$@"; do - if [ ! -f ${img} ]; then - echo "image file not found: ${img}" + if [ ! -f "${img}" ]; then + echo "image file not found: '${img}'" exit 1 fi asc_key="${tmp_file}.${index}" echo "decoding ${img}" - chunk=$( zbarimg --raw --set disable --set qrcode.enable ${img} 2>/dev/null ) + chunk=$( zbarimg --raw --set disable --set qrcode.enable "${img}" 2>/dev/null ) if [ $? -ne 0 ]; then echo "failed to decode QR image" exit 2