Why am I getting “: No such file or directory” whe

2020-02-05 02:35发布

I'm trying to execute a bash script (git-ftp) but I can't seem to do it. This is what happens:

[trusktr@rocketship ~]$ ~/scripts/git-ftp
: No such file or directory

The file has permissions 755.

This is the contents of the script: http://pastie.org/3567556

Why am I getting this error? What can I do to fix the problem?

标签: git bash shell
2条回答
叛逆
2楼-- · 2020-02-05 03:15

I have seen this error if the script has windows line endings instead of unix line endings. Try running dos2unix on the script and see if you get the same error.

查看更多
小情绪 Triste *
3楼-- · 2020-02-05 03:25

Is there a #! (hash bang) line in the script, and does the pathname resolve?

If the script is running, it may be something in the script. Add this command to the top of the script, before any other command (but of course after the hash bang, if there is one):

set -x   # enable trace mode
查看更多
登录 后发表回答