Uploaded file errors: /bin/sh^M: bad interpreter

Developing in Windows 10.
Upload a shell script from PHPStorm to Unix machine.
When trying to run the shell script get message from hashbang line...
/bin/bash: /var/www/vhosts/mydomain/private/bin/myscript.sh: /bin/sh^M: bad interpreter: No such file or directory

Copying the file using a windows FTP client is fine.

I know its my Windows - Unix line ending translation stuff, but cannot see what settings I have done wrong in PHPStorm.
Is there a list of things to check / recommended settings for this situation?

1 comment

Hi there,

What line ending is used for this file in IDE (look at status bar). If it's Windows -- convert it to Linux one.

So far it could be this one: https://youtrack.jetbrains.com/issue/WI-6988


AFAIK there is no FTP-related settings on PhpStorm end for user to do be able to do anything here. As far as I'm concerned this could be your FTP server config that does such automatic conversion .. or invalid line ending in source file (as already noted above).



Please sign in to leave a comment.