| 
 
komafd2 
初级用户
 
  
 
  
 
积分 53 
发帖 20 
注册 2007-6-8 
状态 离线
 | 
『楼 主』:
 何为转义,转义是一个怎样的过程
 
使用 LLM 解释/回答一下
  
转义字符不仅仅将与其相关的特定字符串转义并替换为特定字符串,而且自身也会被“脱逸”。而且类似于C语言中的转义字符"\",双%会转义并脱逸为单%,四%则脱为双%。 
 
这里的转义不太理解, 
还有转义字符有那些 ^这个取消字符转义的符号,也是转义字符吗? 
请前辈赐教 
Escape characters not only escape and replace the specific string related to them with a specific string, but also the escape characters themselves are "escaped". And similar to the escape character "\" in C language, double % will be escaped and escaped to single %, and four % will be escaped to double %. 
 
I don't quite understand the escape here. 
Also, is the symbol ^ that cancels character escaping an escape character? 
Please teach me, senior. 
    
 
  
 |   
 | 
  2008-2-29 23:01 | 
  
 | 
 | 
 
Climbing 
铂金会员
 
        网络独行侠
  
 
积分 6962 
发帖 2753 
注册 2003-4-16 来自 河北保定 
状态 离线
 | 
『第 2 楼』:
 
 
使用 LLM 解释/回答一下
  
我的理解:所谓的转义字符,就是将一个本来具有特殊意义的字符的特殊意义去掉,而以它本身的面貌呈现。 
例如,在cmd命令行中,“| > <”这些符号表示管道操作,但现在我想通过echo显示一个管道符号给用户,例如我照下面这样写:
 
echo 2>1 is true.
 
由于这里的>号默认是作为管道操作符出现的,直接在cmd下执行这个命令会显示如下:
  
d:\work\dos>echo 2>1 is true 
 is true 
 
很显然,这不是我们需要的结果,我们需要将>号默认的管道操作这个特殊意义去掉,那么我们用如下的命令就可以了:
  
d:\work\dos>echo 2^>1 is true 
2>1 is true 
  
My understanding: The so-called escape character is to remove the special meaning of a character that originally had a special meaning and make it appear as it is. 
For example, in the cmd command line, symbols like "| > <" represent pipe operations. But now I want to use echo to display a pipe symbol to the user. For example, I write as follows:
 
echo 2>1 is true.
 
Since the > sign here is defaulted to appear as a pipe operator, executing this command directly in cmd will display as follows:
  
d:\work\dos>echo 2>1 is true 
 is true 
 
Obviously, this is not the result we need. We need to remove the special meaning of the default pipe operation of the > sign. Then we can use the following command:
  
d:\work\dos>echo 2^>1 is true 
2>1 is true 
  
    
 
 
 
  
  |  
                  
  
                    偶只喜欢回答那些标题和描述都很清晰的帖子! 
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人! 
 |   
 | 
  2008-3-1 15:29 | 
  
 | 
 | 
 
qzwqzw 
银牌会员
 
      天的白色影子
  
 
积分 2343 
发帖 636 
注册 2004-3-6 
状态 离线
 | 
     『第 3 楼』:
 
 
使用 LLM 解释/回答一下
  
楼上的理解有问题 
转义,顾名思义 
就是将其它的字符转换意义(通常是其后紧跟的字符或字符串) 
这有些类似于C语言或正则表达式中的字符"\" 
 
在命令行下 
^是转义字符,就是将管道和重定向之类的字符的功能符号转换为可显示符号 
%是转义字符,就是将后面的字符的显示特性转换为变量标识 
"是转义字符,就是将其间的字符的功能符号转换为可显示符号 
 
转义字符的英文是Escape Character 
 
有时候也翻译为逃逸字符 
除了是对Escape的直译之外 
还因为它转换其它字符的意义后 
自己也逃逸不见了 
 
当然起初的理由来源于ANSI组织的一个输入输出标准 
DOS下的驱动程序ANSI.SYS就是这个标准的简单实现 
ANSI.SYS 定义了一系列特殊标记 
用来改变显示图形、控制光标移动和键的重定义 
ANSI.SYS 设备驱动程序支持转义序列的 ANSI 终端仿真 
以便控制系统的屏幕和键盘 
 
这些特殊标记均由字符Esc(ASCII码为十六进制的1B)和字符[起始 
而Esc就是Escape的缩写 
所以这些特殊标记被称为“Escape sequence” 
而这个起始的特殊字符就被称为“Escape character” 
 
而以后起到类似作用的字符则大多继续沿用了这个称谓 
There are problems with the understanding of the person upstairs. 
 
Escape, as the name implies, is to convert the meaning of other characters (usually the immediately following character or string). 
 
This is somewhat similar to the character "\" in C language or regular expressions. 
 
In the command line, ^ is an escape character, which converts the function symbols such as pipes and redirects into displayable symbols. % is an escape character, which converts the display characteristics of the following characters into variable identifiers. " is an escape character, which converts the function symbols of the characters in between into displayable symbols. 
 
The English of the escape character is Escape Character. 
 
Sometimes it is also translated as escape character. In addition to being a literal translation of Escape, it is also because after it converts the meaning of other characters, it itself escapes and disappears. 
 
Of course, the initial reason comes from an input and output standard of the ANSI organization. The device driver ANSI.SYS under DOS is a simple implementation of this standard. ANSI.SYS defines a series of special markers to change the display graphics, control cursor movement and key redefinition. The ANSI.SYS device driver supports ANSI terminal emulation of escape sequences to control the system's screen and keyboard. 
 
These special markers are all composed of the character Esc (ASCII code is hexadecimal 1B) and the character 
 
  
    
 
 
 
  
 |   
 | 
  2008-3-1 17:00 | 
  
 | 
 | 
 
komafd2 
初级用户
 
  
 
  
 
积分 53 
发帖 20 
注册 2007-6-8 
状态 离线
 | 
『第 4 楼』:
 谢谢俩位前辈赐教
 
使用 LLM 解释/回答一下
  
看了俩位前辈的解释 
觉得clinbing前辈的 
 
转义字符,就是将一个本来具有特殊意义的字符的特殊意义去掉,而以它本身的面貌呈现。 具体指的是^ ,这一点跟qzwqzw前辈的关于^的解释一样 
 
但是对qzwqzw前辈的话有几点还想在请教 
在命令行下 
^是转义字符,就是将管道和重定向之类的字符的功能符号转换为可显示符号 
%是转义字符,就是将后面的字符的显示特性转换为变量标识 
"是转义字符,就是将其间的字符的功能符号转换为可显示符号 
 
这里的在命令行下,是说在命令行下只有这三个是转义字符吗? 
第二,%  是 将后面的字符的显示特性转换为变量标识 , 
这里的显示特性就是显示字符 (即打什么字符就显示什么字符,对吗) 
转换位变量标识,我可以理解为将字符转变为变量名吗? 
还有这一句 
 
这些特殊标记均由字符Esc(ASCII码为十六进制的1B)和字符
 
 
 
 
  <>
   Last edited by komafd2 on 2008-3-1 at 06:25 PM ] 
After reading the explanations of the two predecessors, I think that the escape character of the clinbing predecessor is to remove the special meaning of a character that originally has a special meaning and present it as its own appearance. Specifically, it refers to ^, which is the same as the explanation of ^ by the qzwqzw predecessor. 
 
But there are a few points about the words of the qzwqzw predecessor that I still want to ask for advice. 
 
Under the command line, ^ is an escape character, which is to convert the function symbols such as pipes and redirections into displayable symbols. 
% is an escape character, which is to convert the display characteristics of the following characters into variable identifiers. 
" is an escape character, which is to convert the function symbols of the characters in between into displayable symbols. 
 
Is "under the command line" here referring to only these three being escape characters under the command line? 
Second, % is to convert the display characteristics of the following characters into variable identifiers. 
Here, the display characteristics are display characters (that is, what character is typed is displayed as what character, right?) 
Converted to a variable identifier, I can understand it as converting the character into a variable name? 
 
And this sentence 
 
These special markers are all composed of the character Esc (ASCII code is hexadecimal 1B) and the character 
 
 
 
 
 
 
 
 
   Last edited by komafd2 on 2008-3-1 at 06:25 PM ] 
    
 
  
 |   
 | 
  2008-3-1 18:24 | 
  
 | 
 | 
 
qzwqzw 
银牌会员
 
      天的白色影子
  
 
积分 2343 
发帖 636 
注册 2004-3-6 
状态 离线
 | 
『第 5 楼』:
 
 
使用 LLM 解释/回答一下
  
楼上的理解还是片面了 
转义字符,脱逸字符,逃逸字符是Escape character的不同译法 
实际上是完全一样的 
至少在DOS领域内 
 
至于4楼算是问道点子上了 
在命令行下的转义字符种类取决于对转义字符的理解 
通常情况下 
我提到的这三个是大家公认的转义字符 
其它的一些是则有争议的 
比如FOR变量中~,set中的=等 
 
关于%的理解我没有什么需要补充的 
 
至于Escape sequence(通常译为“转义序列”) 
它是转义字符+被转义字符的合称 
它的具体内容和含义 
你只要查找一下论坛ANSI的资料就清除了 
The understanding of the person upstairs is still one-sided. Escape characters, escape characters, and escape characters are different translations of Escape character. In fact, they are exactly the same. At least in the DOS field. As for the 4th floor, it is a relevant question. The types of escape characters under the command line depend on the understanding of escape characters. Usually, the three I mentioned are the universally recognized escape characters. Some others are controversial. For example, ~ in FOR variables, = in set, etc. There is nothing I need to add about the understanding of %. As for Escape sequence (usually translated as "escape sequence"), it is the combination of escape character + escaped character. For its specific content and meaning, you can just look up the forum ANSI materials to clear it up. 
    
 
 
 
  
 |   
 | 
  2008-3-1 23:45 | 
  
 | 
 | 
 
Climbing 
铂金会员
 
        网络独行侠
  
 
积分 6962 
发帖 2753 
注册 2003-4-16 来自 河北保定 
状态 离线
 | 
『第 6 楼』:
 
 
使用 LLM 解释/回答一下
  
谢谢qzwqzw兄详细的解释,我原来的理解确实有些片面了,受教了。 
Thanks to brother qzwqzw for the detailed explanation. My original understanding was indeed one-sided. I've learned a lot. 
    
 
  
  |  
                  
  
                    偶只喜欢回答那些标题和描述都很清晰的帖子! 
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人! 
 |   
 | 
  2008-3-2 01:00 | 
  
 | 
 | 
 
komafd2 
初级用户
 
  
 
  
 
积分 53 
发帖 20 
注册 2007-6-8 
状态 离线
 | 
『第 7 楼』:
 谢谢各位强辈的赐教
 
使用 LLM 解释/回答一下
  
谢谢各位前辈的耐心赐教, 
看了qzwqzw前辈的解释,似乎更加理解了,再次感谢! 
 
 Last edited by komafd2 on 2008-3-2 at 01:29 PM ] 
Thanks to all the seniors for your patient teaching. 
After reading the explanation from senior qzwqzw, I seem to understand it better. Thanks again! 
 
 Last edited by komafd2 on 2008-3-2 at 01:29 PM ] 
    
 
  
 |   
 | 
  2008-3-2 13:27 | 
  
 | 
 | 
 
p308945 
初级用户
 
  
 
  
  
积分 21 
发帖 11 
注册 2010-5-9 
状态 离线
 | 
『第 8 楼』:
 
 
使用 LLM 解释/回答一下
  
好!不过我还是有些疑惑! 
Okay! But I still have some doubts! 
    
 
  
 |   
 | 
  2010-6-27 12:23 | 
  
 |