dos2unix

dos2unix doesn't convert the env file even with -f option


When I ran the the npm command, it threw an error like this.

10:13 $ npm install --legacy-peer-deps

> project-client@1.0.0 prepare
> scripts/transpile

/usr/bin/env: ‘bash\r’: No such file or directory

I figured that it had something to do with a line ending issue in Windows, so I tried the following.

✔ /usr/bin
11:00 $ dos2unix env
dos2unix: Failed to open temporary output file: Permission denied
dos2unix: problems converting file env
✘-13 /usr/bin
11:01 $ sudo dos2unix env
dos2unix: Binary symbol 0x02 found at line 1
dos2unix: Skipping binary file env

The answer on the post below says that adding the option -f will force the conversion,

dos2unix: Binary symbol found, skipping binary file

but it still didn't let me convert it.

✔ /usr/bin
11:01 $ sudo dos2unix env -f
dos2unix: Binary symbol 0x02 found at line 1
dos2unix: Skipping binary file env

Is there any work around to deal with this?


Solution

  • First option -f, then the file name:

    sudo dos2unix -f env