Reputation: 45
I have a simple bash shell script I'm running under Git Bash in Windows 10. If I include the usual first line:
#!/bin/bash
I get the error:
bash: #!/bin/bash: No such file or directory
If I omit that line, I get the error:
bash: $'\357\273\277': command not found
I found some commentary online that $'\357\273\277' is a byte-order mark but I don't know what to do with that information. How can I correct this?
Edit: I realize there is no /bin/bash in a Windows file system, but is there an equivalent that should be used for Git Bash?
Upvotes: 1
Views: 1156
Reputation: 1092
The text editor saved the file with a BOM that is causing an error. In most editors you find a setting to exclude the byte order mark on save. For instructions on how to do that on Visual Studio, see: UTF-8 without BOM
Upvotes: 2
Reputation: 628
seems like bash is not located in directory you are importing from, make sure you bash is installed in /bin directory only or you can search it by
locate bash
it will give you exact location of bash and you can use that
example:- if you bash located in /tmp/bash then you can import it like
#!/tmp/bash
or you can check if bash is even installed or not using
cat /etc/shells
Upvotes: 0
Reputation: 939
Try this for your first line in your script:
#!/usr/bin/bash
I also have Git Bash installed under Windows and when I did a "which bash" I got "/usr/bin/bash".
Upvotes: 0