Walt Mankowski via plug on 23 Aug 2019 07:07:31 -0700


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Shell syntax vs crontab syntax


I run fail2ban and it generates a lot of email. I decided to switch
from putting everything in one enormous maildir to monthly maildirs.
Rather than making a whole bunch (and then likely forgetting about it)
I figured I'd make a cron job that would add the next month's folder.

If I run this on the command line it works fine:

  maildirmake /tmp/fail2ban.`date --date='next month' '+%Y%m'`

But when I tried to use that same syntax in my crontab I got the message:

  /bin/sh: 1: Syntax error: EOF in backquote substitution

What ended up working was this:

  maildirmake /tmp/fail2ban.`date --date='next month' \+\%Y\%m`

I've run into situations like this in the past where the quoting rules
for the shell and crontab seem to be different. I've never found
anything that explains why it's different. Is it because I'm using
zsh?

Walt

Attachment: signature.asc
Description: PGP signature

___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug