I'm trying out the coffee script repl inside Emacs (under ArchLinux) and I'm seeing these escape characters surrounding the prompt:
[1Gcoffee> [0K[9G
These shouldn't be colors as I already enabled the ansi-color-for-comint-mode
. So does anyone recognize these?
P.S.: Funny thing is I don't have this issue under my Emacs+Cygwin setup!
Escaping is a method of quoting single characters. The escape (\) preceding a character tells the shell to interpret that character literally. With certain commands and utilities, such as echo and sed, escaping a character may have the opposite effect - it can toggle on a special meaning for that character.
Escape characters. Escape characters are used to remove the special meaning from a single character. A non-quoted backslash, \, is used as an escape character in Bash. It preserves the literal value of the next character that follows, with the exception of newline.
These are all special characters, which may have to be escaped to preserve their literal meaning within double quotes: $ <dollar-sign>, e.g. $() and ${} ` <grave-accent>, also known as the backquote operator. ” <quotation-mark>, when we need a double quote within double quotes.
The escape () preceding a character tells the shell to interpret that character literally. With certain commands and utilities, such as echo and sed, escaping a character may have the opposite effect – it can toggle on a special meaning for that character. How do I remove special characters from a UNIX shell script?
Characters that need escaping are different in Bourne or POSIX shell than Bash. Generally (very) Bash is a superset of those shells, so anything you escape in shellshould be escaped in Bash. A nice general rule would be "if in doubt, escape it".
With certain commands and utilities, such as echo and sed, escaping a character may have the opposite effect – it can toggle on a special meaning for that character. How do I remove special characters from a UNIX shell script?
List of characters which needs to be escaped in a linux shell command 4 cut : use "/" as a delimiter See more linked questions Related 7 How can I escape characters in SQLite via bash shell?
I don't know where they're coming from (something to do with your shell prompt, obviously, but it's hard to say more than that).
I read them as:
[1G
- Move to column 1 (Cursor Character Absolute)[0K
- Erase to right[9G
- Move to column 9It looks like an attempt by the shell to ensure that the prompt is at the far left of an empty line. Not sure what shell you have, but zsh does something similar when the PROMPT_SP
option is enabled. I don't think it uses the above sequences, though.
Many, many, control sequences can be found here. Note that the sequence "ESC[
" is interpreted as a "Control Sequence Introducer" (CSI) and is shown as that on that page.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With