[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: The correspondence of the command-name and its key-sequence.
From: |
tomas |
Subject: |
Re: The correspondence of the command-name and its key-sequence. |
Date: |
Mon, 11 Jan 2021 10:51:55 +0100 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Mon, Jan 11, 2021 at 09:20:46AM +0100, Omar Polo wrote:
>
> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
> > On Sat, Jan 9, 2021 at 6:00 PM Omar Polo <op@omarpolo.com> wrote:
> > [...]
> >
> > Why the \ has two forms in the ascii document as shown below:
> >
> > $ man ascii | grep -F '\\'
> > 034 28 1C FS (file separator) 134 92 5C \
> > '\\'
> >
> > As you can see, the document gives two forms of it:
> >
> > \ '\\'
>
> I guess, but it's only a guess, that's because \ is used for escaping
> chars.
The man page quoted above confirms your guess. Let me quote some relevant
lines (elisions marked with [...]):
man ASCII:
| DESCRIPTION
| ASCII is the American Standard Code for Information Interchange.
| It is a 7-bit code. Many 8-bit codes (e.g., ISO 8859-1) contain ASCII
| as their lower half. The international counterpart of
| ASCII is known as ISO 646-IRV.
|
| The following table contains the 128 ASCII characters.
|
| C program '\X' escapes are noted.
|
| Oct Dec Hex Char Oct Dec Hex Char
| ────────────────────────────────────────────────────────────────────────
| 000 0 00 NUL '\0' (null character) 100 64 40 @
| 001 1 01 SOH (start of heading) 101 65 41 A
| 002 2 02 STX (start of text) 102 66 42 B
| [...]
| 032 26 1A SUB (substitute) 132 90 5A Z
| 033 27 1B ESC (escape) 133 91 5B [
| 034 28 1C FS (file separator) 134 92 5C \ '\\'
| 035 29 1D GS (group separator) 135 93 5D ]
The relevant bit is the phrase above "C program '\X' escapes are
noted". Background is that, for C character and string literal
notation, an "escape convention" is used: whenever you want to
write a non-printable character, you use a so-called "escape
character" followed by something else. For example, for a newline
character, you say '\n', the escape being the '\'.
Now what do you do when trying to represent the escape character
itself? You just double it, like so: '\\'.
For lots of background, history, and the different conventions
in use, the Wikipedia page [1] is, as often, a great resource.
Cheers
[1] https://en.wikipedia.org/wiki/Escape_character
- t
signature.asc
Description: Digital signature
- The correspondence of the command-name and its key-sequence., Hongyi Zhao, 2021/01/09
- RE: The correspondence of the command-name and its key-sequence., Drew Adams, 2021/01/09
- Re: The correspondence of the command-name and its key-sequence., Hongyi Zhao, 2021/01/09
- Re: The correspondence of the command-name and its key-sequence., Omar Polo, 2021/01/09
- Re: The correspondence of the command-name and its key-sequence., Hongyi Zhao, 2021/01/09
- Re: The correspondence of the command-name and its key-sequence., Omar Polo, 2021/01/09
- Re: The correspondence of the command-name and its key-sequence., Hongyi Zhao, 2021/01/11
- Re: The correspondence of the command-name and its key-sequence., Omar Polo, 2021/01/11
- Re: The correspondence of the command-name and its key-sequence.,
tomas <=
- Re: The correspondence of the command-name and its key-sequence., Francis Belliveau, 2021/01/09
- Re: ASCII - Why...? -- as promised., Francis Belliveau, 2021/01/14
- RE: The correspondence of the command-name and its key-sequence., Drew Adams, 2021/01/09
Re: The correspondence of the command-name and its key-sequence., Kévin Le Gouguec, 2021/01/09