~gpanders/pushbroom

927d4885b373a811fc47aba3001667d953db2e58 — Greg Anders 4 years ago 146882e
Add quotes around argument variables to help with paths that contain spaces
2 files changed, 6 insertions(+), 6 deletions(-)

M bin/janitor
M install.sh
M bin/janitor => bin/janitor +3 -3
@@ 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)"

M install.sh => install.sh +3 -3
@@ 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 <target directory>] [-t <trash directory>] [-n <integer>]"
}



@@ 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"
}