You are not logged in.
Hey everyone is it possible, via bash, to have an echo'd line of text display on a single terminal. but have that single line, not be scrolled upward and out of sight when the next command is run? So basically you're creating a permanent "header" on the terminal. Any other commands with a lot of output like tcpdump, or htop, will be under "underneath" the echo'd text?
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline
a. One could change the title
http://stackoverflow.com/questions/5343 … -in-ubuntu
example
#!/bin/bash
set_title() { printf "\e]2;$*\a"; }
set_title "1"
sleep 1
set_title "2"
sleep 1
set_title "3"
b. or perhaps echo things to /tmp/file and have another window open to reload that /tmp/file
Last edited by brontosaurusrex (2015-11-13 21:04:27)
Offline
Hmm not sure if the set_title would work. I'm running this terminator emulator without a window around it. It has to be "in the terminal"
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline
You could use screen or tmux to create a separate pane in terminal window, like this:
Why exactly do you want to do this?
http://xyproblem.info/
Offline
terminator emulator without a window around it
c. tmux perhaps
#!/bin/bash
set_title() { tmux rename-window "$1"; }
set_title "a"
sleep 1
set_title "b"
sleep 1
set_title "c"
↥ Completely untested.
expanded: a naive approach to check from where the script is run
#!/bin/bash
set_title() {
if [ ! -z "$TMUX" ]; then
tmux rename-window "$1";
else
printf "\e]2;$*\a";
fi
}
set_title "a"
sleep 1
set_title "b"
sleep 1
set_title "yes baby"
↥ Completely untested and probably wrong.
d. using notify-send
#!/bin/bash
set_title() { notify-send -t 30000 "$1"; }
set_title "oh"
sleep 1
set_title "ah"
sleep 1
set_title "blah"
Last edited by brontosaurusrex (2015-11-13 21:10:48)
Offline
Why exactly do you want to do this?
http://xyproblem.info/
Heh...I actually found the XY problem even more interesting than the actual solution.. The reason is just my own preference. I'd like the look of having the header stay on screen, while I can still type commands and work. Thanks very much though, you too brontosaurus! I was trying to avoid downloading another termie emu. but it seems like tmux is pretty the way to go for customization?
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline
I'd go with b. where you can use tmux for window spliting (or not) and the logging to file part will be useful all the way to scripts life-cycle (for example running script from cron). It's also the simplest and not tied to a specific tech solution.
(You can also write something that would combine b. and c. < that should cover a lot of script usage cases)
Last edited by brontosaurusrex (2015-11-14 07:51:45)
Offline
tmux & screen are not terminal emulators.
they would be able to do what you want, i guess.
you can also achieve a lot with the (bash) prompt, click & read some of the links here, people have been doing crazy stuff with it:
https://wiki.archlinux.org/index.php/Co … t#See_also
Offline
You could use screen or tmux to create a separate pane in terminal window
Inside terminator? You might get lost there! LOL.
My 2cents. tmux is amazing. Perhaps not that much or not that evident if running the X, but a true killer tool if running the tty. It takes the tty to a full new level.
Offline
Inside terminator? You might get lost there! LOL.
I didn't think of that...
I always use rxvt-unicode
Offline
Inside terminator? You might get lost there! LOL.
you mean like that movie where they dive deeper and deeper into a dream within a dream within a dream...
i keep forgetting the name...
Offline
^ you thinking of Inception?
@Horizon_Brave - are you looking to set a static header, or are you wanting it to change as you work for whatever reasons?
If it is a static header, then it is easy to place it in the tmux status bar (where the clock is in HOAS' screenshot of tmux).
I've never used tmux with terminator (or terminator much at all, does it have a status bar like a tmux session?), but tmux should run in terminator.
Last edited by PackRat (2015-11-14 19:26:50)
You must unlearn what you have learned.
-- yoda
Offline
About the xy problem, quoting
User doesn't know how to do X, but thinks they can fumble their way to a solution if they can just manage to do Y.
I don't really find that particularity interesting or funny, I would call that the default human behavior and the solution (when found) will:
- prevent future me to behave in the same way, so in itself is a (long-term) solution.
- doing Y did a lot of important discoveries (where X was declared uninteresting at the end)
- doing Y will/may raise common know-how
- doing Y will prevent dogmatic (single book) behaviors
- the direct solution to X (generally accepted dogma) may be so stupid, that it actually needs a better way with Y in between
- I could find a lot more here
Conclusion: xy problem does need a rewrite, since it misses the actual problem, heh
Last edited by brontosaurusrex (2015-11-14 18:12:01)
Offline
^ you thinking of Inception?
lol...I was thinking the same thing...
@Horizon_Brave - are you looking to set a static header, or are you wanting it to change as you work for whatever reasons?
If it is a static header, then it is easy to place it in the tmux status bar (where the clock is in HOAS' screenshot of tmux).
http://s28.postimg.org/vn6h5f66h/header_in_tmux.jpg
I've never used tmux with terminator (or terminator much at all, does it have a status bar like a tmux session?), but tmux should run in terminator.
Yep, I'll definitely do this with tmux. And no, terminator doesn't have a status bar, atleast not that I've seen so far...Though actually I use Guake Terminal emulator the most. Thanks everyone!
"I have not failed, I have found 10,000 ways that will not work" -Edison
Offline