l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
September 2: Social gathering
Next Installfest:
TBD
Latest News:
Aug. 18: Discounts to "Velocity" in NY; come to tonight's "Photography" talk
Page last updated:
2003 May 21 08:09

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] starting screen from shell startup script
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] starting screen from shell startup script



> So now I'm ready to learn screen.  So I'm about to put screen in my
> startup script.  Except...
>
> Once I login, it'll execute screen, which will run screen again, which
> will run screen again, then again, etc. and it'll be caught in an infinite
> loop.  Or does it detect itself somehow?  Or do I play with my
> bash_profile vs. bashrc thing?  How do I prevent it from running itself
> recursively?

Use an enc var created by screen when it runs to tell your startup
scriptto act differently.

Two such env vars are useful with this
"WINDOW" and "TERM"

By default, screen sets your TERM to be "screen"

Alsl, for each virt screen (0-9) the env var "WINDOW" is given the
value associated with the screen you are on.
If you manually type "screen" and then manually type "control-a c" 3
times, you will be on "window" 3. Press "control-a 2" and you will be on
window 2. the env var WINDOW should have this.

Here is a sample condition check that can be addded to ~/.bashrc perhaps
within the section that is used for interactive sessions:

if [ "$TERM" != "screen" ]; then
    screen
fi

You could of course look to see if WINDOW is greaterthan or equal to "0"
instead. You can also use conditionals to have screen automagically
startup applications in each window for you.

-ME

_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Appahost Applications
For a significant contribution towards our projector, and a generous donation to allow us to continue meeting at the Davis Library.