linux下crontab中的命令行中含有”%”的话前面一定得加转移符”\”

 其实这跟Linux关系不大,倒是跟shell很是相关其实还是跟 crontab最相关:)

当时crontab的log出错信息是:

/bin/sh: -c: line 0: unexpected EOF while looking for matching “’

/bin/sh: -c: line 1: syntax error: unexpected end of file

下面这是从命令man 5 crontab中摘出的一段话:

        The entire command portion of the line, up to  a  newline  or  %

 character,  will  be  executed by /bin/sh or by the shell specified in

 the SHELL variable of the cronfile.  Percent-signs (%)in the command,

 unless  escaped with backslash (\), will be changed into newline char-

 acters, and all data after the first % will be sent to the command  as

 standard input.

意思就是说crontab将忽略"%"后面的字串,把其当作前面命令的输入部分

而且还有个crontab的例子用来说明这个:

0 22 * * 1-5   mail -s "It’s 10pm" joe%Joe,%%Where are your kids?%

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值