ssh - Bash: how to duplicate input/output from interactive scripts only in complete lines? -


how can capture input/ output script in realtime (such tee), line-by-line instead of character-by-character? goal capture input typed interactive prompts of script after backspaces , auto-completion have finished processing (after return key hit).

specifically, trying create wrapper script ssh creates timestamped log of commands used on remote servers. the script, uses tee redirect output filtering, works well, redirected output gets jumbled unsubmitted characters whenever use backspace key or up/down keys scroll through remote history. example: service test stopexitservice test stopart or cd ..logs[1pls -al.

perhaps there way capture terminal's scrollback , redirect tee?

update: have found character-based cleanup solution want of time. however, still hoping answer question (which may msw's answer difficult do).

in unix world there 2 primary modes of handling keyboard input. these known 'raw' in characters passed terminal reading program 1 @ time. mode editors (and such) use because editor needs respond when press key.

the other terminal discipline called 'cooked' line line behavior think of bash line line input backspace , command not executed until press return. ssh has take input in raw, character-by-character mode because has no idea running on other side. example, if running editor on far side, can't wait return before sending key-press. so, have suggested, grabbing shell history on far side reasonable way command-by-command record of bash commands typed.


i oversimplified clarity; installations of bash take input in raw mode because allow editor command modification. example, ctrl-p scrolls command history or ctrl-a goes beginning of line. , bash needs able keys moment typed not waiting return.

this reason capturing on local side obnoxiously difficult: if capture on local side, stream filled backspaces , all of bash's editing commands. true transcript of remote shell executed have parse character stream if remote shell. there problem if run like

vi /some_file/which_is_on_the_remote/machine 

the input stream local ssh filled movement commands snippets of text including backspaces , on , bloody difficult figure out part of bash command , talking editor.

few things involving computers impossible; getting clean input local side of ssh invocation really, hard.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -