Re: screen session remember
Neal Fultz <[email protected]> Thu, 14 Mar 2024 08:50:30 -0700
| Newsgroups | gmane.comp.gnu.screen.user |
|---|---|
| Message-ID | <CAL9B2vfuosBuVENS3oMvf8nbGVT2UuGwE6HMUaYPKv1Y2R0Qcg@mail.gmail.com> |
--0000000000000c12010613a0dc7e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Note that $WINDOW is the number when the process is created, vs `screen -Q` is at runtime - if/when you renumber windows they will no longer match. Maybe that's a bug you can live with, though. On Thu, Mar 14, 2024 at 12:18=E2=80=AFAM aotto <[email protected]> wrot= e: > Hi, thanks for this hint, I update your code > > # Screen only > if [ -n "$STY" ] ; then > source ~/.screendb > > SNUM=3Dd$WINDOW > > if [ -n "${!SNUM}" ] ; then > cd "${!SNUM}" > PROMPT_COMMAND=3D"$PROMPT_COMMAND; sed -i > 's!$SNUM=3D.*!$SNUM=3D'\$(pwd)'!' ~/.screendb" > fi > fi > > the "WINDOW" variable is already do the `screen -Q number` thing and I us= e > the > external ".screendb" for storage. > > > d0=3D/home/myusr/prj/tool > d1=3D/home/myusr > d2=3D/tmp > d3=3D. > d4=3D. > d5=3D. > d5=3D. > d7=3D. > d8=3D. > d9=3D. > > > > On 13.03.24 23:26, Neal Fultz wrote: > > # Screen only > > if [ -n "$STY" ] ; then > > > > d1=3D/home/nfultz/projects > > > > SNUM=3D`screen -Q number` > > SNUM=3Dd${SNUM%% *} > > > > if [ -n "${!SNUM}" ] ; then > > cd "${!SNUM}" > > PROMPT_COMMAND=3D"$PROMPT_COMMAND; sed -i > 's!$SNUM=3D.*!$SNUM=3D'\$(pwd)'!' ~/.bashrc" > > fi > > > > fi > > > --0000000000000c12010613a0dc7e Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Note that $WINDOW is the number when the process is create= d, vs `screen -Q` is at runtime - if/when you renumber windows they will no= longer match. Maybe that's a bug you=C2=A0can live with, though.</div>= <br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Thu= , Mar 14, 2024 at 12:18=E2=80=AFAM aotto <<a href=3D"mailto:aotto1968@t-= online.de">[email protected]</a>> wrote:<br></div><blockquote class= =3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rg= b(204,204,204);padding-left:1ex">Hi, thanks for this hint, I update your co= de<br> <br> # Screen only<br> if [ -n "$STY" ] ; then<br> =C2=A0=C2=A0=C2=A0=C2=A0 source ~/.screendb<br> <br> =C2=A0=C2=A0=C2=A0=C2=A0 SNUM=3Dd$WINDOW<br> <br> =C2=A0=C2=A0=C2=A0=C2=A0 if [ -n "${!SNUM}" ] ; then<br> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cd "${!SNUM}"<br= > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 PROMPT_COMMAND=3D"$PR= OMPT_COMMAND; sed -i 's!$SNUM=3D.*!$SNUM=3D'\$(pwd)'!' ~/.s= creendb"<br> =C2=A0=C2=A0=C2=A0=C2=A0 fi<br> fi<br> <br> the "WINDOW" variable is already do the `screen -Q number` thing = and I use the<br> external ".screendb" for storage.<br> <br> <br> d0=3D/home/myusr/prj/tool<br> d1=3D/home/myusr<br> d2=3D/tmp<br> d3=3D.<br> d4=3D.<br> d5=3D.<br> d5=3D.<br> d7=3D.<br> d8=3D.<br> d9=3D.<br> <br> <br> <br> On 13.03.24 23:26, Neal Fultz wrote:<br> > # Screen only<br> > if [ -n "$STY" ] ; then<br> ><br> > =C2=A0 =C2=A0 d1=3D/home/nfultz/projects<br> ><br> > =C2=A0 =C2=A0 SNUM=3D`screen -Q number`<br> > =C2=A0 =C2=A0 SNUM=3Dd${SNUM%% *}<br> ><br> > =C2=A0 =C2=A0 if [ -n "${!SNUM}" ] ; then<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 cd "${!SNUM}"<br> > =C2=A0 =C2=A0 =C2=A0 =C2=A0 PROMPT_COMMAND=3D"$PROMPT_COMMAND; se= d -i 's!$SNUM=3D.*!$SNUM=3D'\$(pwd)'!' ~/.bashrc"<br> > =C2=A0 =C2=A0 fi<br> ><br> > fi<br> <br> <br> </blockquote></div> --0000000000000c12010613a0dc7e--