我在 Windows 上使用 cygwin 工具的一个端口,它将正常状态消息写入 STRERR。从 PowerShell 运行时,这会产生丑陋的输出:
PS> dos2unix.exe -n StartApp.sh StartApp_fixed.sh
dos2unix.exe : dos2unix: converting file StartApp.sh to file StartApp_fixed.sh in UNIX format ...
At line:1 char:13
+ dos2unix.exe <<<< -n StartApp.sh StartApp_fixed.sh
+ CategoryInfo : NotSpecified: (dos2unix: conve...UNIX format ...:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Run Code Online (Sandbox Code Playgroud)
有没有更好的办法?
PS 我打算发布我找到的一个解决方案,并将其与其他人的答案进行比较。