Preferences

CJefferson parent
I'm not suggesting changing that -- just that when all those programs eventually output, the shell/TTY store each program's output in a separate stream, rather than just multiplex them all together in a giant pile.

jstimpfle
The TTY is just a user-facing device and as such has a single read-write pair.

    - You can read() from it (this is basically what the user types into the keyboard)
    - You can write() to it (this gets translated into what is displayed on the screen)
The TTY has no business separating programs. It doesn't know or care what its input/output is connected to.

What you are looking for is shell redirection.

If you have a problem with redirection in a concrete shell script, get in touch - I can fix it for you :-)

CJefferson OP
I about shell redirection, but sometimes I get annoyed by things like:

* I am running a program, decide to 'ctrl+z, bg' it, but it keeps spewing onto my terminal. Instead, just store it so I can look at later

* I want to say "take the output of the previous program and put it into a file", without either running it again, or cutting + pasting it into a file.

Nothing serious, I just feel there is "something better" (although it would be a serious change).

DSMan195276
Personally I would agree with you. If you don't want to go a hacky route it would require some redesigning, but there's no real reason graphical terminals have to keep acting like a dumb terminals when stuff like what you described is easily achievable.

The best approach would probably be to make parts of the tty framework implementable outside of the kernel. If you could do that, then you could skip the kernel completely and do all the redirection and such directly from the graphical terminal by making it essentially implement it's own tty framework. Getting what you want would be very easy at that point, because you'd have direct access to the inputs and outputs to all of the various processes and process-groups. So it would just be a matter of keeping them all in separate buffers and keeping track of what you're displaying in various outputs.

jstimpfle
> I am running a program, decide to 'ctrl+z, bg' it, but it keeps spewing onto my terminal. Instead, just store it so I can look at later

This exists. It's called "less".

It's not the program which keeps spewing at your terminal. At the point where you Ctrl+z the program has already written the content that keeps being spewn. It's just that the terminal is too slow to display the data in the buffer.

> I want to say "take the output of the previous program and put it into a file", without either running it again, or cutting + pasting it into a file.

I want to do that sometimes, too. And then I just re-run it.

It's not a problem of the implementation, I just didn't run it right the first time.

Shells could be implemented to remember the output of your last command-line. There are some questions though: Where should the output be stored (memory / disk usage), what about very big or infinite streams, what about interactive applications... "less" is such a program it makes a particular set of decisions wrt to these questions.

This item has no comments currently.