View previous topic :: View next topic |
Author |
Message |
volumen1 Guru
Joined: 01 Mar 2003 Posts: 393 Location: Missoula, MT
|
Posted: Sat Jan 24, 2004 5:13 am Post subject: gnu screen inside of gnu screen? |
|
|
I apologize if this is a stupid question, but it's not especially easy to do web searches for "screen" and get relevant data.
Anyway, here's my deal. On all my machines, I have the following in my .bashrc Code: | if [ "$TERM" = "screen" ]; then
/usr/bin/fortune
else
if [ "$TERM" != "dumb" ]; then
exec screen
fi
fi
# Login greeting ------------------
if [ "$TERM" = "screen" -a ! "$SHOWED_SCREEN_MESSAGE" = "true" ]; then
detached_screens=`screen -list | grep Detached`
if [ ! -z "$detached_screens" ]; then
echo "+---------------------------------------+"
echo "| Detached screens are available: |"
echo "$detached_screens"
echo "+---------------------------------------+"
else
echo "[ screen is activated ]"
fi
export SHOWED_SCREEN_MESSAGE="true"
fi |
So, basically, tests are made against the terminal type, screen is spawned, fortune is spawned and then a little message shows me which detached screens I have. This is all well and good.
However, when I ssh from one of these machines to the other, I am starting screen on the remote machine. However, all my Cnrl-A commands still go to the original screen process.
I'd like to be able to ssh to the remote machine from inside of screen. Then, have screen start on that machine and then when I hit Cntrl-A,C it will spawn a new screen on the remote box.
Is there any easy way to do this? _________________ I was born with a freakin' dice bag on my belt.
-- www.howsyournetwork.com |
|
Back to top |
|
|
viperlin Veteran
Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Sat Jan 24, 2004 8:47 pm Post subject: |
|
|
when i tryed this script it does not print out any detached screens, or anything, it seems to do nothing at all. |
|
Back to top |
|
|
volumen1 Guru
Joined: 01 Mar 2003 Posts: 393 Location: Missoula, MT
|
Posted: Sat Jan 24, 2004 9:50 pm Post subject: Hmmm... it works for me |
|
|
So, when you start screen, it doesn't list your detached screens? You put it in your .bashrc? It works for me.
Start screen and then do a cntrl-a,d. Then start another screen session. If it doesn't show you your detached screens then try to "source ~/.bashrc" and see what happens. If that doesn't work then do an "echo $TERM" and make sure your term is set to screen.
Aside from that, though, do you have any ideas on my screen question? _________________ I was born with a freakin' dice bag on my belt.
-- www.howsyournetwork.com |
|
Back to top |
|
|
viperlin Veteran
Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Sat Jan 24, 2004 10:00 pm Post subject: |
|
|
it's in bashrc, i've sourced it, i copy and pasted yours, i've got screens detached, nothing shows, in normal terminal $TERM is rxvt, inside screen $TERM is screen. |
|
Back to top |
|
|
volumen1 Guru
Joined: 01 Mar 2003 Posts: 393 Location: Missoula, MT
|
Posted: Sat Jan 24, 2004 10:07 pm Post subject: Hmm... |
|
|
I'd try and just go through it line by line.
echo $SHOWED_SCREEN_MESSAGE and make sure that it's not true (that'd be weird)
Then do screen -list | grep Detached and see if anything shows up.
If not, then do screen-list and see what it does show you? Which version of screen are you running? I'm using 4.00.01. _________________ I was born with a freakin' dice bag on my belt.
-- www.howsyournetwork.com |
|
Back to top |
|
|
viperlin Veteran
Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Sat Jan 24, 2004 10:10 pm Post subject: Re: Hmm... |
|
|
volumen1 wrote: | I'd try and just go through it line by line.
echo $SHOWED_SCREEN_MESSAGE and make sure that it's not true (that'd be weird)
Then do screen -list | grep Detached and see if anything shows up.
If not, then do screen-list and see what it does show you? Which version of screen are you running? I'm using 4.00.01. |
Code: |
[john@Raiden john]$ echo $SHOWED_SCREEN_MESSAGE
[john@Raiden john]$
|
screen 4.0.1-r2
.bashrc:
Code: |
PS1="\[\033[0;32m\[[\u@\h \W]$ \033[0m\]"
alias ls="ls --color"
alias lsd="ls --color -d */"
alias logout="clear && exit"
alias whatip="wget -O - http://www.whatismyip.com 2> /dev/null | grep \"<h1>\" | cut -d \" \" -f 4"
alias h='history | sort -k 4 | uniq -f 4 | sort -n'
#login greeting----------------------
if [ "$TERM" = "screen" -a ! "$SHOWED_SCREEN_MESSAGE" = "true" ]; then
detached_screens=`screen -list | grep Detached`
if [ ! -z "$detached_screens" ]; then
echo "+---------------------------------------+"
echo "| Detached screens are available: |"
echo "$detached_screens"
echo "+---------------------------------------+"
else
echo "[ screen is activated ]"
fi
export SHOWED_SCREEN_MESSAGE="true"
fi
shopt -s checkwinsize
|
and yes i have tried "screen -list | grep Detached " it shows them
:-\ |
|
Back to top |
|
|
volumen1 Guru
Joined: 01 Mar 2003 Posts: 393 Location: Missoula, MT
|
Posted: Sat Jan 24, 2004 10:11 pm Post subject: |
|
|
What does screen -list show? That is, run it when you know you have some detached windows. _________________ I was born with a freakin' dice bag on my belt.
-- www.howsyournetwork.com |
|
Back to top |
|
|
viperlin Veteran
Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Sat Jan 24, 2004 10:15 pm Post subject: |
|
|
volumen1 wrote: | What does screen -list show? That is, run it when you know you have some detached windows. |
it lists the screens of cource |
|
Back to top |
|
|
volumen1 Guru
Joined: 01 Mar 2003 Posts: 393 Location: Missoula, MT
|
Posted: Sat Jan 24, 2004 10:19 pm Post subject: Heh... |
|
|
I guess that was a stupid question. I'm running the exact version of screen that you are.
Maybe add a line in your .bashrc that does an "echo $detached_screens" so you can see where it's going wrong?
Wait... I be I know what it is. Check your /etc/screenrc. What does your shell line look like? Mine is
shell -$SHELL (that makes it run as a login shell). Maybe your screen doesn't do that, so it's not executing your .bashrc when you start screen? _________________ I was born with a freakin' dice bag on my belt.
-- www.howsyournetwork.com |
|
Back to top |
|
|
viperlin Veteran
Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Sat Jan 24, 2004 10:33 pm Post subject: |
|
|
it's in /etc/screenrc
it is executing .bashrc when i start screen because it complains about one of my other problems:
Code: |
-/bin/bash: dircolors: command not found
[john@Raiden john]$
|
|
|
Back to top |
|
|
volumen1 Guru
Joined: 01 Mar 2003 Posts: 393 Location: Missoula, MT
|
Posted: Sat Jan 24, 2004 10:37 pm Post subject: |
|
|
Man... that's weird. Maybe add a line in your .bashrc that echoes $detached_screens, maybe that's getting dorked up somehow.
Say, on a unrelated note. What's your 'h' alias all about. It's sorting on the 4th field of history? Is that like so you can get unique 'cd whatever' in your history? _________________ I was born with a freakin' dice bag on my belt.
-- www.howsyournetwork.com |
|
Back to top |
|
|
viperlin Veteran
Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Sat Jan 24, 2004 10:40 pm Post subject: |
|
|
just quick access to my bash history, try it, it's nice |
|
Back to top |
|
|
volumen1 Guru
Joined: 01 Mar 2003 Posts: 393 Location: Missoula, MT
|
Posted: Sat Jan 24, 2004 10:46 pm Post subject: |
|
|
Yeah, I got that. But I don't understand the two sorts and the uniq that you got in there? I thought that the -k 4 references would be for the 4th column. But, what would that be? _________________ I was born with a freakin' dice bag on my belt.
-- www.howsyournetwork.com |
|
Back to top |
|
|
viperlin Veteran
Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Sat Jan 24, 2004 10:56 pm Post subject: |
|
|
volumen1 wrote: | Yeah, I got that. But I don't understand the two sorts and the uniq that you got in there? I thought that the -k 4 references would be for the 4th column. But, what would that be? |
actualy i dont know, i didn't write it, i got it from a post usefull basrc contents thread. |
|
Back to top |
|
|
volumen1 Guru
Joined: 01 Mar 2003 Posts: 393 Location: Missoula, MT
|
Posted: Sat Jan 24, 2004 11:04 pm Post subject: |
|
|
Gotcha... Now I'm intrigued so I'll mess around with it. Did you try to echo $detached screens? What did it show? _________________ I was born with a freakin' dice bag on my belt.
-- www.howsyournetwork.com |
|
Back to top |
|
|
viperlin Veteran
Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Sat Jan 24, 2004 11:08 pm Post subject: |
|
|
volumen1 wrote: | Gotcha... Now I'm intrigued so I'll mess around with it. Did you try to echo $detached screens? What did it show? |
it showed:
screen -list | grep Detached
it just printed the command, didn't run it |
|
Back to top |
|
|
volumen1 Guru
Joined: 01 Mar 2003 Posts: 393 Location: Missoula, MT
|
Posted: Sat Jan 24, 2004 11:15 pm Post subject: |
|
|
That's weird. On this line:
Code: | detached_screens=`screen -list | grep Detached` |
Do you have those as single quotes or as back-ticks? It seems like back ticks and that should work. I would try screwing around with that line and see if you can make it work. Try it without quotes or back-ticks, maybe? _________________ I was born with a freakin' dice bag on my belt.
-- www.howsyournetwork.com |
|
Back to top |
|
|
viperlin Veteran
Joined: 15 Apr 2003 Posts: 1319 Location: UK
|
Posted: Sat Jan 24, 2004 11:18 pm Post subject: |
|
|
just goign to try it with these 3
'
"
` |
|
Back to top |
|
|
timfreeman Tux's lil' helper
Joined: 19 May 2003 Posts: 142 Location: Chicago
|
Posted: Tue Jan 27, 2004 9:00 am Post subject: |
|
|
volumen1 wrote: | Yeah, I got that. But I don't understand the two sorts and the uniq that you got in there? I thought that the -k 4 references would be for the 4th column. But, what would that be? |
useful alias ..
uniq needs sorted input, but then you'd want to sort it again by command number for display.
in regard to the 4th column .. maybe this was for a different history? if you replace the 2 4's with a 2, you may get a more copious output .. _________________ ||| |
|
Back to top |
|
|
mahir l33t
Joined: 05 Dec 2003 Posts: 725 Location: London
|
Posted: Tue Feb 10, 2004 4:31 pm Post subject: help please |
|
|
how would i get fortune
to come up everytime i open my term?
i dont want the screen thing
just for fortune to come up everytime i open gnome-terminal
?
any ideas? _________________ "wa ma tawfiqi illah billah"
Mahir Sayar |
|
Back to top |
|
|
volumen1 Guru
Joined: 01 Mar 2003 Posts: 393 Location: Missoula, MT
|
Posted: Thu Feb 19, 2004 6:45 pm Post subject: |
|
|
Just put this in your .bashrc
_________________ I was born with a freakin' dice bag on my belt.
-- www.howsyournetwork.com |
|
Back to top |
|
|
marienZ Retired Dev
Joined: 02 Jul 2003 Posts: 30 Location: the Netherlands
|
Posted: Thu Feb 19, 2004 9:16 pm Post subject: |
|
|
Quote: | However, when I ssh from one of these machines to the other, I am starting screen on the remote machine. However, all my Cnrl-A commands still go to the original screen process.
I'd like to be able to ssh to the remote machine from inside of screen. Then, have screen start on that machine and then when I hit Cntrl-A,C it will spawn a new screen on the remote box. |
I think you want to use screen's "ctrl+a a" command, which means "pass on ctrl+a to whatever is running inside this screen". So if you press "ctrl+a a c" it will spawn a new shell on the remote box, "ctrl+a a S" splits the windows on the remote box's screen, and "ctrl+a a ctrl+a a" does on the remote box what "ctrl+a ctrl+a" does on your local box. |
|
Back to top |
|
|
Wi1d Apprentice
Joined: 15 Mar 2004 Posts: 282 Location: USA, Iowa
|
Posted: Mon Dec 20, 2004 6:16 am Post subject: Re: gnu screen inside of gnu screen? |
|
|
volumen1 wrote: | but it's not especially easy to do web searches for "screen" and get relevant data. |
How true. How true. |
|
Back to top |
|
|
volumen1 Guru
Joined: 01 Mar 2003 Posts: 393 Location: Missoula, MT
|
Posted: Mon Dec 20, 2004 4:13 pm Post subject: |
|
|
Yeah, I sometimes think that the people who named the programs "screen" and "mon" will be forced to do google searches for their own software in the afterlife. Either that, or they'll be pushing a huge boulder up a hill over and over again. _________________ I was born with a freakin' dice bag on my belt.
-- www.howsyournetwork.com |
|
Back to top |
|
|
|