GNU screen - open new window in working directory of current window in a named (sessionname) session?

0

1

In order to open a new screen window in the same directory as the current working directory of the screen window you are launching it from (rather than the directory you initially launched the screen session from), this works:

Using screenrc, how can I make `C-a c` open a new window at the current window's working directory?

...unless the current screen session has had its name set with C-a, :sessionname. In that case where for example the session is named:

$ screen -ls
There are screens on:
        18282.FOO_BAR (11/02/16 16:25:52)     (Attached)

instead of opening a new screen window the solution in the answer linked to above gives for example:

$ screen -X chdir $PWD;screen
/var/run/screen/S-username/18282.pts-29.hostname: No such file or directory
/var/run/screen/S-username/18282.pts-29.hostname: No such file or directory

Is a workaround possible to make this work for named screen sessions?

Paul Caheny

Posted 2016-02-11T15:33:06.840

Reputation: 153

1I was trying to investigate this, but it worked with named session right as it was. Maybe a downlevel version?

Mine is: Screen version 4.01.00devel (GNU) 2-May-06 – Gombai Sándor – 2016-02-11T16:34:21.700

Thanks Gombai, my screen version happens to be identical. Could you cut and paste exactly what you are using in your .screenrc to open the new window at the current window's working directory? – Paul Caheny – 2016-02-11T18:10:27.797

My one and only bind line is exactly as written in the linked topic:

bind c stuff "screen -X chdir $PWD; screen^M"

where ^M is Ctrl-M – Gombai Sándor – 2016-02-11T19:42:37.717

Went back to double check Gombai, unfortunately I have the problem as described in the original question with just a single bind line in my .screenrc identical to yours and with an identical version of screen. – Paul Caheny – 2016-02-15T10:00:12.460

No answers