How to make all line endings (EOLs) in all files in Visual Studio Code, UNIX like?

后端 未结 6 552
有刺的猬
有刺的猬 2021-01-01 08:36

I use Windows 10 home and I usually use Visual Studio Code (VSCODE) to edit Linux Bash scripts as well as PHP and JavaScript.

I don\'t develop anything dedicated for

6条回答
  •  攒了一身酷
    2021-01-01 09:14

    To convert the line ending for existing files

    We can use dos2unix in WSL or in your Shell terminal.

    Install the tool:

    sudo apt install dos2unix
    

    Convert line endings in the current directory:

    find -type f -print0 | xargs -0 dos2unix
    

    If there are some folders that you'd want to exclude from the conversion, use:

    find -type f \
         -not -path ".//*" \
         -not -path ".//*" \
         -print0 | xargs -0 dos2unix
    

提交回复
热议问题