Re: screen session remember

aotto <[email protected]> Thu, 14 Mar 2024 08:18:19 +0100
Newsgroups gmane.comp.gnu.screen.user
Message-ID <[email protected]>
Hi, thanks for this hint, I update your code

# Screen only
if [ -n "$STY" ] ; then
     source ~/.screendb

     SNUM=d$WINDOW

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

the "WINDOW" variable is already do the `screen -Q number` thing and I use the
external ".screendb" for storage.


d0=/home/myusr/prj/tool
d1=/home/myusr
d2=/tmp
d3=.
d4=.
d5=.
d5=.
d7=.
d8=.
d9=.



On 13.03.24 23:26, Neal Fultz wrote:
> # 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