2009-10-28, 20:28(-04), Dave Rutherford: [...] > Add to .Xdefaults: XTerm*answerbackString: ^[[2~ > Add to .bashrc (and .profile if it doesn't source .bashrc): > bind '"^[[2~": overwrite-mode' > PROMPT_COMMAND='echo -n ^E' [...]
Along those lines, you could use the TIOCSTI ioctl. That would be system dependant instead of terminal dependant. Like sti.c: #include <stdio.h> #include <sys/ioctl.h> #include <unistd.h> int main(int argc, char *argv[]) { int i; char *c; if (!isatty(0)) return 0; for (i = 1; i < argc; i++) { if (i > 1 && ioctl(0, TIOCSTI, " ") == -1) { perror("ioctl"); return 1; } for (c = argv[i]; *c; c++) { if (ioctl(0, TIOCSTI, c) == -1) { perror("ioctl"); return 1; } } } return 0; } And PROMPT_COMMAND="sti \$'\05'" > If the user drops down to a PS2, etc. > prompt, that line will be in insert mode. [...] Same problem here. -- Stéphane