aid*_*dan 0 linux ubuntu command-line-interface cron echo
$ echo -e "test1\ntest2" > logfile
$ echo -e "test1\ntest2" >> logfile
$ cat logfile
test1
test2
test1
test2
$ rm logfile
$ crontab -e
* * * * * echo -e "test1\ntest2" >> logfile
$ sleep 160
$ cat logfile
-e test1
test2
-e test1
test2
Run Code Online (Sandbox Code Playgroud)
为什么我-e在输出中得到 ?crontab 和 bash 都在使用/bin/echo
他们可能不会同时使用/bin/echo. 使用的环境cron可能与您的交互式环境不同。指定完整路径以确保。
| 归档时间: |
|
| 查看次数: |
9752 次 |
| 最近记录: |