I have this code:
# Generate bash script
$bashScript = "#!/bin/bash`n";
$bashScript += [string]::Join("`n", $cmds)
[System.IO.File]::WriteAllLines($location.ToString() + ".\build.sh", $bashScript);
The problem is that I always get CRLF characters at the end of the file!
#!/bin/bash [LF]
tsc ... [LF]
java ... [LF]
java ... [CR][LF]
Is there anything I can do except replacing CRLF at the end?
I don’t speak Powershell, but it seems to me that you’ve told it to write one big line (
$bash_script) with a newline (CRLF) at the end. CallWriteAllTextinstead. Be sure to have a LF at the end of the file.