I have experienced similar behaviour before, but only now I can reproduce it: Output from a command affecting the text after the next command prompt, ready to be Entered by the user.
Take the following example:
cat /usr/share/terminfo/a/ansi
which has the following effect:
Or, copied and pasted:
1%dP1%dM1%dB1%d@1%dS1%dL1%dD1%dC1%dT1%dA%p1%c2%{1}%-%db%p1%dd
1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m +%d;%dR;0123456789]c1%dm1%dmAX[user@untrusted ~]$ R65;1;9c
As you can see, R65;1;9c
appears after the command prompt and pressing Enter will have it evaluated as command.
I do remember cases where text not only appeared after the command line, but was also executed again, possibly due to it containing newlines.
Can this be considered bug or is this anticipated behaviour, that some kind of combination of non-printable characters allows writing after the next command prompt?
Best Answer
What you are seeing is the attribute string for the terminal. Terminals might respond differently to one or more of these commands.
A quick way to reproduce them:
In my case, inside
Gnome terminal
this types65;1;9c
, insidexterm
it types64;1;2;6;9;15;18;21;22c
and in the console, after pressing Ctrl-Alt-F1 I get6c
.The strings are created by the terminal, so you cannot use them to "insert" arbitrary text.
This page tells you more about their meaning:
Some devices will also output identifying information for the device (Request terminal parameters) with the following escape sequence.