Sun 25 Mar 2012 07:32:42 PM UTC, original submission:
If I create a screen called "moo" via
screen -S moo
and then create screen moose via
screen -S moose
and then attempt to reattach moo via
screen -r moo
I get
There are several suitable screens on:
13960.moo (Detached)
13969.moose (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.
rather than it simply attaching moo.
Now, this behavior can be kludged around by using -d/-D and -RR, but it creates a few problems:
if moo is attached, and moose is detached, screen -RR moo will attach to moose instead.
If moo is attached, screen -d -RR moo will detach it.
This is not the original behavior of -r:
screen -r moo if moo was attached would normally output
There is a screen on:
13960.moo (Attached)
There is no screen to be resumed matching moo.
This can also be worked around by using the full name of moo:
screen -r 13960.moo, or just screen -r 13960, but then why bother with the session name at all?
I understand that it's useful to be able to type just "screen -r moo" when you mean session name moose, but wouldn't it make more sense to check if there's an exact match too? If I have a command named dd, and a command named ddrescue, bash doesn't get all confused and make me type the full path to dd.
Moreover, wouldn't having
screen -R sessionname
do the aggressive matching make more sense?
An example of what this would be like follows:
$ screen -ls
There are screens on:
13995.moo (Detached)
14022.moose (Detached)
2 Sockets in /var/folders/5r/37vxtt554lgfskbrxs_b2ldh0000gn/T/.screen.
$ screen -r moo
<attaches screen moo>
[detached]
$ screen -R moos
<attaches screen moose>
[detached]
$ screen -R moo
There are several suitable screens on:
13995.moo (Detached)
14022.moose (Detached)
Type "screen [-d] -r [pid.]tty.host" or "screen -r full_session_name" to resume one of them.
$ screen -r moos
There is no screen to be resumed matching moos.
|