Re:Ask HN: What do you love/hate about terminals? Would you ...
by jstimpfle on Wednesday December 27, 2017 @09:18AM
(#16014851)
Then it's not cat anymore. The purpose of cat is to output the inputs unchanged and concatenated. If you need magic, that's a task for another program.
Re:Ask HN: What do you love/hate about terminals? Would you ...
by lornemalvo on Thursday December 28, 2017 @05:34AM
(#16021330)
`cat` is doing exactly that. It is up to another program, namely the terminal emulator to interpret its output.
Re:Ask HN: What do you love/hate about terminals? Would you ...
by jstimpfle on Thursday December 28, 2017 @06:32AM
(#16021500)
The terminal emulator does not (and should not, according to my strong opinion) interpret the output of different programs differently.
In fact it's not currently technically possible for a terminal emulator to know which program is writing into it. It maybe many programs simulatenously, or it may be the kernel asynchronously, etc... If you want to change that you would have to make the architecture tremendously more complicated and less flexible.
And the same goes for shells. You don't want to complicate the architecture just so that a lawyer could attest you that "it was cat" who drew the image und some weird interpretation. Nothing would be gained, and nobody would be able to understand what's happening anymore.
Making plain `cat` work too should not be too big of a problem with some small support from the running shell. iTerm2 also knows when a command is starting to run/exits, parsing the output it retrieved from STDOUT in between by matching it against some magic numbers and displaying the content accordingly is not too difficult.