screen-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: screen session remember


From: Neal Fultz
Subject: Re: screen session remember
Date: Wed, 13 Mar 2024 15:26:56 -0700

I would probably tackle this on the shell side rather than in .screenrc.

 For example, in ~/.bashrc, on startup, we can check what the number of the screen is. And use PROMPT_COMMAND to update to the most recent eg using sed. 

# Screen only
if [ -n "$STY" ] ; then
  
    d1=/home/nfultz/projects

    SNUM=`screen -Q number`
    SNUM=d${SNUM%% *}

    if [ -n "${!SNUM}" ] ; then
        cd "${!SNUM}"
        PROMPT_COMMAND="$PROMPT_COMMAND; sed -i 's!$SNUM=.*!$SNUM='\$(pwd)'!' ~/.bashrc"
    fi

fi

This could/should be made much more robust but hopefully that shows that it is possible.

-Neal Fultz




On Wed, Mar 13, 2024 at 2:12 PM aotto <aotto1968@t-online.de> wrote:
Thanks for the answer - this hint I already use.

→ but I would like to have a "replacement" which is always "up-to-time"

On 13.03.24 22:01, Anton Sharonov wrote:
> On Wed, Mar 13, 2024 at 08:46:30PM +0100, aotto wrote:
>> I have a “screen session” with 10 screens and after
>> rebooting I want each screen (0-9) to start in the same
>> directory in which it was closed.
> Maybe not exactly what you are asking for, but you can
> hardcode your shells to curtain path on start using something
> like this in your ~/.screenrc:
>
>
> screen -t 0_vim
> screen -t 1_vim_doc
> ... continue with your number of shells ...
> at 0 stuff "cd ~/.vim^j"
> at 1 stuff "cd ~/.vim/doc^j"
> ... etc ...
>
>
> With best regards, Anton




reply via email to

[Prev in Thread] Current Thread [Next in Thread]