I have a Cron Job running quarterly on every first Sunday of the Month:
0 0 1-7 3,6,9,12 * [ "$(date '+\%a')" == "Sun" ] && /script.sh
Now I want to install it automatically using echo like:
(crontab -l ; echo "0 0 1-7 3,6,9,12 * [ "$(date '+\%a')" == "Sun" ] && /script.sh") | crontab -
while escaping \"Sun"\
works fine I can't escape "$(date '+\%a')"
as this is a mix of single and double quotes with \
within double quoted echo command.