Anyway, one can write a small filter, to cut any suspicious sequences from the output off, and add some wrapper like that to your bashrc:
curl() { [ -t 1 ] && curl "$@" | sanitize || curl "$@"; }
Text after a blank line that is indented by two or more spaces is reproduced verbatim. (This is intended for code.)
curl() { [ -t 1 ] && curl "$@" | sanitize || curl "$@"; }oh my god. From http://www.termsys.demon.co.uk/vtansi.htm :
> Set Key Definition <ESC>[{key};"{string}"p
> Associates a string of text to a keyboard key. {key} indicates the key by its ASCII value in decimal.
But I can't reproduce it; in my terminal (gnome-terminal), `print('\x1b[97;"echo foo"p')` just shows `cho foo"p`.
So it looks like not all terminals implement it, if any?
This wasn't an uncommon thing back in the 90s with DOS ANSI art. I'm not sure if the original ANSI.SYS included with DOS 5/6 but there was a period of time where people remapped things like "echo y|format c:" using ANSI that only required one to "type somefile.ans/txt". The "fix" was to use an accelerated ANSI driver that dropped key-remapping.
From what I understand, “curl example.com” is almost exactly as risky as “curl example.com | bash”, since curl does not escape terminal command sequences, and those can include key rebindings; e.g. your Enter key can be rebound to “rm -rf ∗” or “sendfile ∗ [email protected]”.