Friday, December 31, 2010

% in crontab

if you would like to use construction like this `date '+%a'` in crontab, you need to backslash the % sign.

1 1 * * * touch /tmp/`date '+\%a'`.touch

It works in Linux but in Solaris does not. It creates file names where is a slash before a week name.

In Solaris the ' sign should not be used.

1 1 * * * touch /tmp/`date +\%a`.touch

No comments:

Post a Comment