From: Simon Ruderich Date: Mon, 1 Apr 2013 17:26:55 +0000 (+0200) Subject: crontab.d/update.sh: Expand $HOME when changing $PATH in crontab files. X-Git-Url: https://ruderich.org/simon/gitweb/?a=commitdiff_plain;h=a9e86502129b92ddb62f6034aaa1a4bc10c4214b;p=config%2Fdotfiles.git crontab.d/update.sh: Expand $HOME when changing $PATH in crontab files. --- diff --git a/crontab.d/update.sh b/crontab.d/update.sh index ebffb99..05519bb 100755 --- a/crontab.d/update.sh +++ b/crontab.d/update.sh @@ -70,12 +70,15 @@ for file in "$DIRECTORY"/crontab.*; do echo >> "$CRONTAB" echo "## $file:" >> "$CRONTAB" + # Strip licenses, multiple empty lines and fix $HOME variables in PATH + # (cron doesn't expand variables). START_REGEX='^# This [a-zA-Z]* is free software: you can redistribute it' END_REGEX='^# along with this [a-zA-Z]*. If not, see <[^>]*>\.' < "$file" sed -e "/$START_REGEX/,/$END_REGEX/ d" \ -e "/^#[ ]*$/ d" \ -e "/^# Copyright (C) [0-9][0-9]* / d" \ | cat --squeeze-blank \ + | sed "/^PATH/ s:\$HOME:$HOME:g" \ >> "$CRONTAB" done