cron 裡面的百分比符號 % 有特殊意義...

在試了一陣子後才發現的問題,crontab 裡的百分比符號 % 是特殊字元:「escaping double quotes and percent signs (%) in cron」。

取自 Debian 上的 crontab(5)

Percent-signs (%) in the command, unless escaped with backslash (\), will be changed into newline characters, and all data after the first % will be sent to the command as standard input.

有點奇怪就是了,因為有 echo 可以用才對?

Leave a Reply

Your email address will not be published. Required fields are marked *