Keep bash (gnome-terminal) prompt at the top
Hi,
After 2 years of using bash via gnome-terminal I've decided it is annoying that the prompt/input area keeps moving after output. Can I make it stay on top? Make all output go under that particular line like so: _________________________________________________ Code:
[user@computer /]$ | <-- blinking I-beam Cheers EDIT: I know the problem is ill-defined. I guess I just want to invert the scrolling direction. cheers |
I understand what you're thinking. You want a kind of separate command input box at top, with scrolling output underneath.
Well, it's possible to use ansi escape codes or tput in your PS1 or PROMPT_COMMAND to reposition the cursor at the top of the screen after each command. However, the output scrolling is a separate function, so you'd just end up positioning it inside whatever text was just printed in your last command. It wouldn't act like a "floating" box or anything. I don't know if it's possible to directly control the scrolling behavior, either, especially not to "reverse" it. There'd be a lot of possible situations to consider, like how to treat commands that give out formatted data, or continuous streams, as well as how to deal with multi-line command input. I imagine you'd have to completely redesign the console from scratch to be sure to create the kind of split behavior you want. |
I doubt it's possible because the shell simply prints the prompt after the last command's output.
I guess the only good solution would be to make a terminal with a line entry on top where you enter the command and it pastes the command into the actual terminal window below when you hit enter. |
Thanks for your fine answers,
@MTK358: Unless I dreamt it I think I saw someone somewhere on the internet who did have that kind of behaviour in his virtual consoles (the kind you're describing). I beleive he used some sort of script, like a wrapper that read input and gave output. He could do lots of cool stuff with it, although it was still gnome-terminal/bash under the hood. I'll post a link if I find it (or have another vivid dream about it). cheers |
Also, I don't understand why it's moving for you. Once it hits the bottom after a few commands it stays at the bottom and doesn't move!
|
Quote:
A function rather than a script would execute in the same shell and so have access to its settings. The $PROMPT_COMMAND variable can be used to run a command (= alias, built-in command, external command or function) after each command returns. The $BASH_COMMAND variable holds the last command executed. |
All times are GMT -5. The time now is 10:44 PM. |