diff --git a/cron-list.sh b/cron-list.sh index 813e1c2..9057440 100644 --- a/cron-list.sh +++ b/cron-list.sh @@ -14,7 +14,7 @@ if [ ! -f $CRON_LIST ]; then fi echo "Reading current crontab jobs into a variable..." -current_crontab=$(crontab -l 2>/dev/null || :) +current_crontab=$(crontab -l 2>/dev/null || true) echo "Iterate through the lines of the cron.list file..." while IFS= read -r line; do @@ -28,7 +28,7 @@ while IFS= read -r line; do echo "The task already exists: $line" else echo "Adding a job to crontab..." - (crontab -l; echo "$line") | crontab - + (crontab -l 2>/dev/null || true; echo "$line") | crontab - echo "Task added: $line" fi done < "$CRON_LIST"