Once I had a file, to see the contents I used cat command, say cat filename, its content was displayed on the terminal, also automatically it typed some random characters on my terminal and enter key also got typed and then terminal prompted command not found.
I was wondering whether it is possible to write commands in file and executing those commands using cat command.
I am not able to get that file again and also searching is not helpful. But I am sure some one over here must know this.
Add a comment
|
1 Answer
This sounds like a file which had escape sequences that caused the terminal to read the following string as input. These days that capability tends to not be supported by terminal programs because it's a fairly obvious security issue.
One way this used to be doable was by programming the DEC "answerback" sequence, which the terminal would transmit in response to a Ctrl+E embedded in the file.
9 Comments
A.H.
xterm, gnome-terminal and the linux console have this "feature" up to now. I tested it by catting some large binary file. So I think this "feature" is burried inside the kernel. But what sequence exactly triggers this ... I don't know.
geekosaur
Still? That is bad. (But only the Linux console one is in the kernel; the others, it is part of those programs.) I could not tell you offhand what the sequence is that's triggering it; historically there were a number of possibilities for different terminals.
A.H.
All terminals (even xterm & co) use the kernel for TTY handling - either in the form of "pseudo terminals" (xterm & co) or "virtual consoles". And I guess that's the culprit here.
geekosaur
But ptys do not have built in emulation of any kind, and this is controlled by the emulation.
A.H.
Good point. So it seems the VC on one hand and xterm & Co on the other hand try to stay compatible with each other with independent code. :-)
|