3

I have been working with a script, which I haven't done for some time now. It was suggested to me to use VS code to develop the script and then I use pscp to get the file from my windows computer into the Linux machine which I am connected to.

Once I do this and attempt to run the script on the Linux machine I get the following error: /bin/bash^M: bad interpreter: No such file or directory

In my settings.json file of VS Code I have my terminal.intergrated.shell.windows set to a bash.exe. I have came across this question: Bash script and /bin/bash^M: bad interpreter: No such file or directory

and from it one of the suggestions was because I am importing from a windows to linux machine there are some characters which do not cross over correctly thus the ^M error. Is there a way to set up VS Code to code in a Linux environment when it is transferred over? Thanks for any info!

hitman99x
  • 63
  • 3

1 Answers1

3

at the bottom of VSCode there should be a little toolbar. If you click on CRLF and instead change it to LF your problems should be resolved when developing the code from then onwards. The reason this happens is because whenever you create a new line in Windows it takes two characters to do so. The CR (Carriage Return) and LF (Line Feed) whereas Linux only uses LF (Line Feed).

Hope this helped :)

LF CRLF

Zik
  • 101
  • 3