如何在 Powershell 中创建 unix 文件格式?我正在使用以下内容创建文件,但它始终以 Windows 格式创建文件。
"hello world" | out-file -filepath test.txt -append
据我了解,新行字符 CRLF 使其成为 Windows 格式文件,而 unix 格式只需要在行尾有一个 LF。我尝试用以下内容替换 CRLF,但没有用
"hello world" | %{ $_.Replace("`r`n","`n") } | out-file -filepath test.txt -append
最佳答案
PowerShell Community Extensions 中有一个 Cmdlet称为 ConvertTo-UnixLineEnding
关于windows - 使用 Powershell 的 UNIX 格式文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5102115/