Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/unix/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何从svn中转义^M:eol风格本机_Svn_Unix_Eol - Fatal编程技术网

如何从svn中转义^M:eol风格本机

如何从svn中转义^M:eol风格本机,svn,unix,eol,Svn,Unix,Eol,我们在subversion存储库中为shell脚本指定了eol-style:native属性;这将删除在Windows上编辑文件并在UNIX上执行时包含的^M字符 但最近我们遇到了一个问题: 一个shell脚本编写了以下语句: sed 's/^M//g' source_file > target_file 替换数据文件中的^M个字符。但是,当脚本在subversion中签入并在unix框中更新时,语句变为: sed 's/ //g' source_file > target_fil

我们在subversion存储库中为shell脚本指定了
eol-style:native
属性;这将删除在Windows上编辑文件并在UNIX上执行时包含的
^M
字符

但最近我们遇到了一个问题:

一个shell脚本编写了以下语句:

sed 's/^M//g' source_file > target_file
替换数据文件中的^M个字符。但是,当脚本在subversion中签入并在unix框中更新时,语句变为:

sed 's/
//g' source_file > target_file
真正的问题
我需要一种方法将^M字符放入subversion中的shell脚本中,并且
eol style:native
属性已经存在。我不希望这个特定的^M角色在转换中丢失。可能吗?

使用
\r
而不是^M

sed 's/\r//g' source_file > target_file

我们需要修改的数据文件有
^M
个字符;
\r
会摆脱它们吗?@SiB^M是一个\r,除非你字面上是指插入符号+M而不是ctrl+MI。我很惊讶Subversion会影响这一点,因为这不是一个字符,而只是一个字符。我认为这是Subversion中的一个bug。如果您将此文件更改为具有
LF
svn:eol样式,该怎么办?这会影响你的sed脚本吗?否则,希望您的
sed
脚本是GNU,并且它将需要
\r
。可能的副本