Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

LF vs CRLF


Which is incredibly painful on Windows systems doing a git clone of shell scripts, since core.autocrlf is often helpful, but not for shell scripts, since it causes the weirdest looking error messages:

  MSYS$ cat build.sh
  #!/bin/bash
  echo "hello, world"
  MSYS$ ./build.sh
  : not found: 2: build.sh
e.g. https://askubuntu.com/questions/370124/not-found-error-when-...

Polite projects will have .gitattributes specifying that .sh or .bash or bin/* or whatever are to always checkout with eol=lf <https://git-scm.com/docs/gitattributes#_eol>

As best I can tell, .ps1 does tolerate Unix lf but I'd bet good money that .bat and .cmd definitely do not


Thanks for reminding. Added.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: