So, latest #Linux weirdness:

I have a series of commands ‘VMBoxManage’ that I want to call from a cron job.

If I execute the commands as my user, no issue. If I execute the commands as a cron job (as my user) no issue. If I put the commands in a nice tidy bash script, and call it from the CLI or cron, no worky. (Command not found)

EDIT: actual error message is “cannot execute: required file not found”

I currently have it working with a massive, ugly command in cron. (I.e. /usr/bin/command1 && /usr/bin/command2 &&…) but it’s ugly.

How fix?

@crispius That it started as a DOS thing has no issue. System cron runs as a user with a different $PATH variable (less filled). Check / update your PATH settings in the affected file(s)
@sebastiaanfranken
Fixed. Create new .sh file, copy contents from old file into it. Make executable. Bingo.
@crispius Glad it's fixed! Weird that that fixed it though, since that should have no effect *at all*, unless something else was also going on at the same time (SELinux context, user/group ownership, etc). Anyway, I'm diving into this unneeded haha

@sebastiaanfranken
from the page where I found the solution:

"Your demo.sh script is a DOS text file. Such files have CRLF line endings, and that extra CR (carriage-return) character at the end of the line is causing you issues.

The specific issue it's causing is that the interpreter pathname on the #!-line now refers to something called /bin/bash\r (with the \r symbolising a carriage-return, which is a space-like character, so it's usually not visible). This file is not found, so this is what causes your error message."

@crispius Yeh that's partially BS, but I'll leave it for now. You can by the way convert it with "dos2unix" (from the package by the same name), or use vim ("vim <filename> -c 'set ff=unix' -c ':wq'") The vim one opens the file, sets the file ending to unix and enters the ":wq" command (write and quit)