I have searched the Internet for hours for a solution to my issue, and I can't seem to find an answer or solve what I'm doing wrong. I am trying to set up a cron to run a perl script on a regular basis. I am using Ubuntu 18.04.3 LTS as a virtual machine on Oracle VM Virtualbox 5.2.26, running on a Windows 10 host.

I have not been successful running the perl script, so I have tried execute a number of other commands to test what I'm doing wrong. I'm having issues running a number of commands found in the /usr/bin/ path. I have been able to execute 'echo' and 'printf', but that's about it. Below is my code and the error messages I am receiving from each line (note the 'echo "$PATH"' line seems to work correctly):

2 * * * * /usr/bin/env
2 * * * * env
2 * * * * echo "$PATH"
2 * * * * perl atk_queries.pl
2 * * * * /usr/bin/perl /home/myname/Alpha/ATK_queries/atk_queries.pl
2 * * * * perl /home/myname/Alpha/ATK_queries/atk_queries.pl

Output/Errors In Order of Commands:

(1) /bin/bash: /usr/bin/env: No such file or directory

(2) /bin/bash: $'env\r': command not found

(3) /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/home/myname/Alpha/ATK_queries

(4) Can't open perl script "atk_queries.pl": No such file or directory

(5) Can't open perl script "/home/derek/Alpha/ATK_queries/atk_queries.pl": No such file or directory

(6) Can't open perl script "/home/derek/Alpha/ATK_queries/atk_queries.pl": No such file or directory

Any guidance is greatly appreciated.

  • 1
    Going by the env\r output, can you check if you have a problem with your line endings? See here and here for details.
    – Haxiel
    Dec 2, 2019 at 17:04
  • running $ file crontab returns: ASCII text, with CRLF line terminators
    – cckcckcc
    Dec 2, 2019 at 17:22
  • 1
    ^ That's wrong. You're on a UNIX/Linux-based system not a Windows one.
    – roaima
    Dec 2, 2019 at 17:30

1 Answer 1


Apparently the issue had something to do with modifying my crontab file in Notepad++, which is natively a Windows program. As per Haxiel's comment, there was some wonkiness with \r carriage returns being executed within the commands themselves.

Modifying the file via crontab -e, deleting the crontab contents, replacing them with the exact same text, and saving the file as a non-DOS file led to the successful execution of all commands as well as the Perl script.

  • 1
    Great to see that you have identified and resolved the problem. The line endings are different between the Windows & Unix platforms. Windows uses CR LF (\r\n) while Unix uses LF (\n). See this SO question for more details: stackoverflow.com/q/1552749/6216002
    – Haxiel
    Dec 2, 2019 at 17:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.