It's possible to inject characters at the tty layer using an IOCTL, e.g. in C, something like:
Code:
#include <sys/ioctl.h>
#include <termios.h>
#include <unistd.h>
int main(int argc, char *argv[])
{
static struct termios tc_save, tc_new;
char *p;
if (argc > 1 )
{
p=argv[1];
tcgetattr(0, &tc_save);
tc_new = tc_save;
tc_new.c_lflag &= ~ECHO;
tcsetattr(0, TCSANOW, &tc_new);
while ( *p )
ioctl(0,TIOCSTI, p++);
tcsetattr(0, TCSANOW, &tc_save);
}
return 0;
}
One could use such a helper in a script to achieve the desired result.
I'm not aware of an escape sequence to do this directly, but I have also seen the behaviour people describe when accidentally catting a binary file. What sequence triggers it and how specific to any particular terminal type it might be however I have no idea.