Ubuntu 14.04 Cron outputs file names with ^M at the end

后端 未结 1 622
南笙
南笙 2021-01-20 00:53

When I pipe output to a file in a cron job using the > operator, it always appends a ^M to the end of the file name. This shows up as a ? when I run ls in the directory but

相关标签:
1条回答
  • 2021-01-20 01:41

    The problem is with the cron or script file itself: it has DOS line separators (CRLF) instead of Unix (LF only). You can fix it using dos2unix.

    0 讨论(0)
提交回复
热议问题