gpt4 book ai didi

windows - Windows 批处理文件中的 LF 与 CRLF 行结尾

转载 作者:可可西里 更新时间:2023-11-01 13:06:52 25 4
gpt4 key购买 nike

我有一个混合的 Ubuntu、OS X 和 Windows git 存储库,其中包含针对 Windows 7 及更高版本的 .bat.cmd 文件。 core.autocrlf 设置为 input,因此在 git checkout 之后,这些文件在我的文件中有 LF 行结尾工作目录而不是我开始时使用的 CRLF 行尾。

这会导致 Windows 批处理执行出现问题吗?在什么情况下这种差异可能很重要?我还没有看到任何问题,但希望进行防御性编码。

最佳答案

您可以使用以下 .gitattributes 文件为批处理文件覆盖此设置:

*.bat text eol=crlf

来自 Is it safe to write batch files with Unix line endings?有一条关于标签无法与 LF 一起正常工作的评论。修复非常简单。

关于windows - Windows 批处理文件中的 LF 与 CRLF 行结尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38836068/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com