![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-15 08:18 |
47,813 topics / 349,902 posts / today 0 new / 48,257 members |
| DOS疑难解答 & 问题讨论 (解答室) » What is escaping, and what is the process of escaping |
| Printable Version 2,337 / 7 |
| Floor1 komafd2 | Posted 2008-02-29 23:01 |
| 初级用户 Posts 20 Credits 53 | |
|
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. |
|
| Floor2 Climbing | Posted 2008-03-01 15:29 |
| 铂金会员 Posts 2,753 Credits 6,962 From 河北保定 | |
|
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:
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:
|
|
| Floor3 qzwqzw | Posted 2008-03-01 17:00 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
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 [at the beginning, and Esc is the abbreviation of Escape, so these special markers are called "Escape sequence", and this initial special character is called "Escape character". And later characters that play a similar role mostly continue to use this title. |
|
| Floor4 komafd2 | Posted 2008-03-01 18:24 |
| 初级用户 Posts 20 Credits 53 | |
|
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 ] |
|
| Floor5 qzwqzw | Posted 2008-03-01 23:45 |
| 银牌会员 Posts 636 Credits 2,343 | |
|
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.
|
|
| Floor6 Climbing | Posted 2008-03-02 01:00 |
| 铂金会员 Posts 2,753 Credits 6,962 From 河北保定 | |
|
Thanks to brother qzwqzw for the detailed explanation. My original understanding was indeed one-sided. I've learned a lot.
|
|
| Floor7 komafd2 | Posted 2008-03-02 13:27 |
| 初级用户 Posts 20 Credits 53 | |
|
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 ] |
|
| Floor8 p308945 | Posted 2010-06-27 12:23 |
| 初级用户 Posts 11 Credits 21 | |
|
Okay! But I still have some doubts!
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |