I'm trying to use this line in a bash script to update my cron jobs:
(sudo crontab -l ; echo "0 6 1-7 * * [ $(/usr/bin/date +\%u) == 7 ] && sh $script_path > $log_path") | sort - | uniq - | sudo crontab -
Prior to this,
$log_path have been defined. I know this works in general. I just have one hang up.
$(/usr/bin/date +\%u) resolves to an empty string when the crontab file is written to. I need that literal text to remain in place.
(Not that is really matters, but the point of that is to verify the day of the week. This job is to be run on the first Saturday of the month).
How do I "escape" that whole substring?