Crontab bash script: no such file or directory Crontab bash script: no such file or directory shell shell

Crontab bash script: no such file or directory


The issue occurs when copying and pasting lines between Windows and Linux when doing a crontab -e.

The Windows LF char x'0d' gets inserted and causes issues. The solution is to remove all lines and type them back in. You can spot the issue by doing a crontab -l | od -x and looking for the 0d characters.


To find the line in the script where the error occurs different parts of the script were commented out. The problem occured even when there was only the first line left, containing:#!/bin/bash

The problem was solved by creating a new script and writing the first line from above manually and pasting the remaining content of the old script. We think there were characters in the first line of the script that were not visible in our editor.