<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Environment Variables and GNU Screen</title>
	<atom:link href="http://alan.lamielle.net/2009/03/09/environment-variables-and-gnu-screen/feed" rel="self" type="application/rss+xml" />
	<link>http://alan.lamielle.net/2009/03/09/environment-variables-and-gnu-screen</link>
	<description>Alan LaMielle</description>
	<lastBuildDate>Mon, 06 Feb 2012 17:01:23 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
	<item>
		<title>By: Update your DISPLAY environment variable for Nomachine and Screen user &#171; zandyware</title>
		<link>http://alan.lamielle.net/2009/03/09/environment-variables-and-gnu-screen/comment-page-1#comment-649</link>
		<dc:creator>Update your DISPLAY environment variable for Nomachine and Screen user &#171; zandyware</dc:creator>
		<pubDate>Sat, 12 Mar 2011 06:16:30 +0000</pubDate>
		<guid isPermaLink="false">http://alan.lamielle.net/?p=80#comment-649</guid>
		<description>[...] http://alan.lamielle.net/2009/03/09/environment-variables-and-gnu-screen  [...]</description>
		<content:encoded><![CDATA[<p>[...] <a href="http://alan.lamielle.net/2009/03/09/environment-variables-and-gnu-screen" rel="nofollow">http://alan.lamielle.net/2009/03/09/environment-variables-and-gnu-screen</a>  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan LaMielle</title>
		<link>http://alan.lamielle.net/2009/03/09/environment-variables-and-gnu-screen/comment-page-1#comment-381</link>
		<dc:creator>Alan LaMielle</dc:creator>
		<pubDate>Thu, 19 Aug 2010 20:14:52 +0000</pubDate>
		<guid isPermaLink="false">http://alan.lamielle.net/?p=80#comment-381</guid>
		<description>Thanks for the improvements!  I actually don&#039;t rely on this nearly as much as I used to (I recently switched to a Mac).  However, I&#039;m still rocking zsh and have the version I posted in my .zshrc.  I&#039;ll update my config.  Thanks again!</description>
		<content:encoded><![CDATA[<p>Thanks for the improvements!  I actually don&#8217;t rely on this nearly as much as I used to (I recently switched to a Mac).  However, I&#8217;m still rocking zsh and have the version I posted in my .zshrc.  I&#8217;ll update my config.  Thanks again!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ryan King</title>
		<link>http://alan.lamielle.net/2009/03/09/environment-variables-and-gnu-screen/comment-page-1#comment-378</link>
		<dc:creator>Ryan King</dc:creator>
		<pubDate>Thu, 19 Aug 2010 02:37:20 +0000</pubDate>
		<guid isPermaLink="false">http://alan.lamielle.net/?p=80#comment-378</guid>
		<description>Hey, thanks for the solution. This was bugging me (my X sessions don&#039;t last long because I have numerous users on this computer, but I want my screen(1) sessions to last as close to forever as possible).

Here&#039;s a slightly more compact version that uses more zsh powerz:

grabvars()
{
  for x in SSH_AGENT_PID SSH_AUTH_SOCK DISPLAY; do
    echo &quot;export $x=&#039;${(P)x:q}&#039;&quot;
  done &gt;$VARSLOC
}
 
sourcevars()
{
[ -f $VARSLOC ] &amp;&amp; source $VARSLOC
}

The differences are:
1) I inlined the variable names inside the loop. I didn&#039;t need the temporary &quot;$VARS&quot; variable, but if I did I would use an array (&quot;VARS=(SSH_AGENT_PID SSH_AUTH_SOCK DISPLAY)&quot;) instead of a string so I could save the &quot;$(echo ...)&quot; part.
2) I used a single echo---no point in creating then parsing the string again. Zsh&#039;s smart (P) Expansion Flag does exactly what we want.
3) Just for completeness I threw in the &#039;q&#039; Parameter Expansion flag so that it would escape a theoretical space/quote/etc.
4) No need to say &quot;1&gt;&quot;, since 1 is STDOUT, and that&#039;s the default for &quot;&gt;&quot;.
5) Used the more idiomatic &quot;[ -f ... ] &amp;&amp; ____&quot; form.

Just some thoughts---Really I&#039;m only tinkering for the fun of it. The overall solution is a smart one, and I wasn&#039;t thinking of it on my own.

Thank you.
-rjk</description>
		<content:encoded><![CDATA[<p>Hey, thanks for the solution. This was bugging me (my X sessions don&#8217;t last long because I have numerous users on this computer, but I want my screen(1) sessions to last as close to forever as possible).</p>
<p>Here&#8217;s a slightly more compact version that uses more zsh powerz:</p>
<p>grabvars()<br />
{<br />
  for x in SSH_AGENT_PID SSH_AUTH_SOCK DISPLAY; do<br />
    echo &#8220;export $x=&#8217;${(P)x:q}&#8217;&#8221;<br />
  done &gt;$VARSLOC<br />
}</p>
<p>sourcevars()<br />
{<br />
[ -f $VARSLOC ] &amp;&amp; source $VARSLOC<br />
}</p>
<p>The differences are:<br />
1) I inlined the variable names inside the loop. I didn&#8217;t need the temporary &#8220;$VARS&#8221; variable, but if I did I would use an array (&#8220;VARS=(SSH_AGENT_PID SSH_AUTH_SOCK DISPLAY)&#8221;) instead of a string so I could save the &#8220;$(echo &#8230;)&#8221; part.<br />
2) I used a single echo&#8212;no point in creating then parsing the string again. Zsh&#8217;s smart (P) Expansion Flag does exactly what we want.<br />
3) Just for completeness I threw in the &#8216;q&#8217; Parameter Expansion flag so that it would escape a theoretical space/quote/etc.<br />
4) No need to say &#8220;1&gt;&#8221;, since 1 is STDOUT, and that&#8217;s the default for &#8220;&gt;&#8221;.<br />
5) Used the more idiomatic &#8220;[ -f ... ] &amp;&amp; ____&#8221; form.</p>
<p>Just some thoughts&#8212;Really I&#8217;m only tinkering for the fun of it. The overall solution is a smart one, and I wasn&#8217;t thinking of it on my own.</p>
<p>Thank you.<br />
-rjk</p>
]]></content:encoded>
	</item>
</channel>
</rss>

