On Fri, Mar 30, 2007 at 07:32:31PM +0100, JCA wrote:
> I wonder if someone could please explain the meaning of the
> following options the screen command:
>
> -d -r Reattach a session and if necessary detach it first.
>
> -d -R Reattach a session and if necessary detach or even create
> it
> first.
>
> -d -RR Reattach a session and if necessary detach or create it.
> Use
> the first session if more than one session is available.
>
> -D -r Reattach a session. If necessary detach and logout
> remotely
> first.
>
> -D -R Attach here and now. In detail this means: If a session is
> run-
> ning, then reattach. If necessary detach and logout
> remotely
> first. If it was not running create it and notify the
> user.
> This is the author's favorite.
>
> -D -RR Attach here and now. Whatever that means, just do it.
>
> I am enclosing them with their description in the screen man page
> because, quite frankly, I do not understand the differences (they all
> sound very similar), and under what circumstances I would want to use
> one of them rather than the others.
I was confused, too, but figured them out (more or less) by careful
re-reading and (more importantly) by experimenting with different
combinations.
The difference between -d and -D is that -D may cause a session to be
logged out remotely, whereas -d will not. This is the only thing I'm
not sure I understand -- if you create a session on host A and then use
screen -d on host B, will it not detach the session that's running on
host A? Do you have to use -D in this case?
The difference between -r and -R is that -R will create a session if no
session can be reattached. The difference between -R and -RR is that
-RR will reattach the first session it finds, whereas -R will throw up
its hands if it finds more than one (i.e., it won't reattach but will
instead list all detached sessions so you can then use screen -r
<session> to specify the one you want to reattach).
> The "if necessary" qualifier is particularly galling, for it is not at
> all clear (to me) how to determine the necessity requirement.
Try re-reading them one at a time. First one:
> -d -r Reattach a session and if necessary detach it first.
Translation: Try to reattach a session. If it's already attached, detach
it and then try again. This way you can start a session in one terminal
and reattach it in another terminal *without having first detached it in
the first terminal*.
Next:
> -d -R Reattach a session and if necessary detach or even
> create it first.
Translation: Try to reattach a session. If it's already attached, detach
it and and then try again. If it's neither attached nor detached --
i.e., if it doesn't even exist -- then create it and attach to it.
Next:
> -d -RR Reattach a session and if necessary detach or create it.
> Use the first session if more than one session is available.
See above.
The remaining combinations (-D -r, -D -R, and -D -RR) are the same
except they will detach *and logout remotely*, whatever that means -- I
always use -D rather than -d.
> The description of -D -RR is the very worst, for it really is a
> useless explanation if there has ever been one (and there has.)
Yikes! Relax; the world won't end if you don't understand this.
Paul.
--
Paul Hoffman <address@hidden>