Double-quote values

This commit is contained in:
Dmitri Popov
2018-08-23 12:19:46 +02:00
parent ba9c963773
commit 7a2842ae7d
4 changed files with 16 additions and 16 deletions

View File

@@ -29,7 +29,7 @@ sudo shutdown -h $SHUTD "Shutdown is activated. To cancel: sudo shutdown -c"
# Wait for camera # Wait for camera
DEVICE=$(gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//') DEVICE=$(gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//')
while [ -z ${DEVICE} ] while [ -z "${DEVICE}" ]
do do
sleep 1 sleep 1
DEVICE=$(gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//') DEVICE=$(gphoto2 --auto-detect | grep usb | cut -b 36-42 | sed 's/,/\//')

View File

@@ -32,15 +32,15 @@ sudo sh -c "echo heartbeat > /sys/class/leds/led0/trigger"
sudo shutdown -h $SHUTD "Shutdown is activated. To cancel: sudo shutdown -c" sudo shutdown -h $SHUTD "Shutdown is activated. To cancel: sudo shutdown -c"
# Wait for a USB storage device (e.g., a USB flash drive) # Wait for a USB storage device (e.g., a USB flash drive)
STORAGE=$(ls /dev/* | grep $STORAGE_DEV | cut -d"/" -f3) STORAGE=$(ls /dev/* | grep "$STORAGE_DEV" | cut -d"/" -f3)
while [ -z ${STORAGE} ] while [ -z "${STORAGE}" ]
do do
sleep 1 sleep 1
STORAGE=$(ls /dev/* | grep $STORAGE_DEV | cut -d"/" -f3) STORAGE=$(ls /dev/* | grep "$STORAGE_DEV" | cut -d"/" -f3)
done done
# When the USB storage device is detected, mount it # When the USB storage device is detected, mount it
mount /dev/$STORAGE_DEV $STORAGE_MOUNT_POINT mount /dev/"$STORAGE_DEV" "$STORAGE_MOUNT_POINT"
# Cancel shutdown # Cancel shutdown
sudo shutdown -c sudo shutdown -c
@@ -50,16 +50,16 @@ sudo sh -c "echo timer > /sys/class/leds/led0/trigger"
sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on" sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on"
# Wait for a card reader or a camera # Wait for a card reader or a camera
CARD_READER=$(ls /dev/* | grep $CARD_DEV | cut -d"/" -f3) CARD_READER=$(ls /dev/* | grep "$CARD_DEV" | cut -d"/" -f3)
until [ ! -z "$CARD_READER" ] until [ ! -z "$CARD_READER" ]
do do
sleep 1 sleep 1
CARD_READER=$(ls /dev/sd* | grep $CARD_DEV | cut -d"/" -f3) CARD_READER=$(ls /dev/sd* | grep "$CARD_DEV" | cut -d"/" -f3)
done done
# If the card reader is detected, mount it and obtain its UUID # If the card reader is detected, mount it and obtain its UUID
if [ ! -z "$CARD_READER" ]; then if [ ! -z "$CARD_READER" ]; then
mount /dev/$CARD_DEV $CARD_MOUNT_POINT mount /dev"/$CARD_DEV" "$CARD_MOUNT_POINT"
# # Set the ACT LED to blink at 500ms to indicate that the card has been mounted # # Set the ACT LED to blink at 500ms to indicate that the card has been mounted
sudo sh -c "echo 500 > /sys/class/leds/led0/delay_on" sudo sh -c "echo 500 > /sys/class/leds/led0/delay_on"
@@ -74,7 +74,7 @@ if [ ! -z "$CARD_READER" ]; then
cd cd
# Set the backup path # Set the backup path
BACKUP_PATH=$STORAGE_MOUNT_POINT/"$ID" BACKUP_PATH="$STORAGE_MOUNT_POINT"/"$ID"
# Perform backup using rsync # Perform backup using rsync
rsync -ah --exclude "*.id" "$CARD_MOUNT_POINT"/ "$BACKUP_PATH" rsync -ah --exclude "*.id" "$CARD_MOUNT_POINT"/ "$BACKUP_PATH"

View File

@@ -31,15 +31,15 @@ sudo sh -c "echo heartbeat > /sys/class/leds/led0/trigger"
sudo shutdown -h $SHUTD "Shutdown is activated. To cancel: sudo shutdown -c" sudo shutdown -h $SHUTD "Shutdown is activated. To cancel: sudo shutdown -c"
# Wait for a USB storage device (e.g., a USB flash drive) # Wait for a USB storage device (e.g., a USB flash drive)
STORAGE=$(ls /dev/* | grep $STORAGE_DEV | cut -d"/" -f3) STORAGE=$(ls /dev/* | grep "$STORAGE_DEV" | cut -d"/" -f3)
while [ -z ${STORAGE} ] while [ -z ${STORAGE} ]
do do
sleep 1 sleep 1
STORAGE=$(ls /dev/* | grep $STORAGE_DEV | cut -d"/" -f3) STORAGE=$(ls /dev/* | grep "$STORAGE_DEV" | cut -d"/" -f3)
done done
# When the USB storage device is detected, mount it # When the USB storage device is detected, mount it
mount /dev/$STORAGE_DEV $STORAGE_MOUNT_POINT mount /dev/"$STORAGE_DEV" "$STORAGE_MOUNT_POINT"
# Cancel shutdown # Cancel shutdown
sudo shutdown -c sudo shutdown -c
@@ -49,7 +49,7 @@ sudo sh -c "echo timer > /sys/class/leds/led0/trigger"
sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on" sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on"
# Perform backup using rsync # Perform backup using rsync
rsync -av $SOURCE_DIR $STORAGE_MOUNT_POINT rsync -av "$SOURCE_DIR" "$STORAGE_MOUNT_POINT"
# Turn off the ACT LED to indicate that the backup is completed # Turn off the ACT LED to indicate that the backup is completed
sudo sh -c "echo 0 > /sys/class/leds/led0/brightness" sudo sh -c "echo 0 > /sys/class/leds/led0/brightness"

View File

@@ -54,11 +54,11 @@ sudo sh -c "echo heartbeat > /sys/class/leds/led0/trigger"
sudo shutdown -h $SHUTD "Shutdown is activated. To cancel: sudo shutdown -c" sudo shutdown -h $SHUTD "Shutdown is activated. To cancel: sudo shutdown -c"
# Wait for a USB storage device (e.g., a USB flash drive) # Wait for a USB storage device (e.g., a USB flash drive)
STORAGE=$(ls /dev/* | grep $STORAGE_DEV | cut -d"/" -f3) STORAGE=$(ls /dev/* | grep "$STORAGE_DEV" | cut -d"/" -f3)
while [ -z ${STORAGE} ] while [ -z ${STORAGE} ]
do do
sleep 1 sleep 1
STORAGE=$(ls /dev/* | grep $STORAGE_DEV | cut -d"/" -f3) STORAGE=$(ls /dev/* | grep "$STORAGE_DEV" | cut -d"/" -f3)
done done
# When the USB storage device is detected, mount it # When the USB storage device is detected, mount it
@@ -72,7 +72,7 @@ sudo sh -c "echo timer > /sys/class/leds/led0/trigger"
sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on" sudo sh -c "echo 1000 > /sys/class/leds/led0/delay_on"
# Perform backup using rsync # Perform backup using rsync
rsync -avhz -e ssh --delete --progress "$STORAGE_MOUNT_POINT" "$USER"@"$REMOTE":"$BACKUP_DIR" rsync -avhz -e ssh --delete --progress "$STORAGE_MOUNT_POINT"/ "$USER"@"$REMOTE":"$BACKUP_DIR"
if [ ! -z "$NOTIFY_TOKEN" ]; then if [ ! -z "$NOTIFY_TOKEN" ]; then
TEXT=$(sed 's/ /%20/g' <<< "Remote backup completed.") TEXT=$(sed 's/ /%20/g' <<< "Remote backup completed.")