From 927d4885b373a811fc47aba3001667d953db2e58 Mon Sep 17 00:00:00 2001 From: Greg Anders Date: Fri, 22 Jan 2016 11:40:53 -0600 Subject: [PATCH] Add quotes around argument variables to help with paths that contain spaces --- bin/janitor | 6 +++--- install.sh | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/janitor b/bin/janitor index 697c990..b3fc0d3 100755 --- a/bin/janitor +++ b/bin/janitor @@ -1,13 +1,13 @@ #!/usr/bin/env bash # Define which folder to clean out (default: ~/Downloads) -export TARGET_DIR=$1 +export TARGET_DIR="$1" # How many days should a file be able to live in the folder? (default: 30) -export DAYS_TO_KEEP=$2 +export DAYS_TO_KEEP="$2" # Trash folder to move deleted files to (default: ~/.Trash) -export TRASH_DIR=$3 +export TRASH_DIR="$3" # Location of Janitor installation export JANITOR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd)" diff --git a/install.sh b/install.sh index 65d8409..4c20caf 100755 --- a/install.sh +++ b/install.sh @@ -5,7 +5,7 @@ TARGET_DIR=$HOME/Downloads NUM_DAYS=30 TRASH_DIR=$HOME/.Trash -function print_usage() { +function usage() { echo "Usage: ./install.sh [-x] [-d ] [-t ] [-n ]" } @@ -24,7 +24,7 @@ while getopts "xd:t:n:" opt; do NUM_DAYS="$OPTARG" ;; \?) - print_usage + usage exit 1 ;; esac @@ -40,7 +40,7 @@ fi function create_crontab() { echo "# Begin Janitor job" - echo "0 */6 * * * $(pwd)/bin/janitor $1 $2 $3" + echo "0 */6 * * * $(pwd)/bin/janitor \"$1\" \"$2\" \"$3\"" echo "# End Janitor job" } -- 2.26.2