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&#39;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 &lt;<a href=3D"mailto:aotto1968@t-=
online.de">[email protected]</a>&gt; 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 &quot;$STY&quot; ] ; 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 &quot;${!SNUM}&quot; ] ; then<br>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 cd &quot;${!SNUM}&quot;<br=
>
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 PROMPT_COMMAND=3D&quot;$PR=
OMPT_COMMAND; sed -i &#39;s!$SNUM=3D.*!$SNUM=3D&#39;\$(pwd)&#39;!&#39; ~/.s=
creendb&quot;<br>
=C2=A0=C2=A0=C2=A0=C2=A0 fi<br>
fi<br>
<br>
the &quot;WINDOW&quot; variable is already do the `screen -Q number` thing =
and I use the<br>
external &quot;.screendb&quot; 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>
&gt; # Screen only<br>
&gt; if [ -n &quot;$STY&quot; ] ; then<br>
&gt;<br>
&gt; =C2=A0 =C2=A0 d1=3D/home/nfultz/projects<br>
&gt;<br>
&gt; =C2=A0 =C2=A0 SNUM=3D`screen -Q number`<br>
&gt; =C2=A0 =C2=A0 SNUM=3Dd${SNUM%% *}<br>
&gt;<br>
&gt; =C2=A0 =C2=A0 if [ -n &quot;${!SNUM}&quot; ] ; then<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 cd &quot;${!SNUM}&quot;<br>
&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 PROMPT_COMMAND=3D&quot;$PROMPT_COMMAND; se=
d -i &#39;s!$SNUM=3D.*!$SNUM=3D&#39;\$(pwd)&#39;!&#39; ~/.bashrc&quot;<br>
&gt; =C2=A0 =C2=A0 fi<br>
&gt;<br>
&gt; fi<br>
<br>
<br>
</blockquote></div>

--0000000000000c12010613a0dc7e--