<?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: Show Unread Gmails in Gnu Screen Status Bar</title>
	<atom:link href="http://tuxtraining.com/2009/04/29/show-unread-gmails-in-gnu-screen-status-bar/feed" rel="self" type="application/rss+xml" />
	<link>http://tuxtraining.com/2009/04/29/show-unread-gmails-in-gnu-screen-status-bar</link>
	<description></description>
	<lastBuildDate>Mon, 03 Aug 2009 07:34:04 -0500</lastBuildDate>
	
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: admin</title>
		<link>http://tuxtraining.com/2009/04/29/show-unread-gmails-in-gnu-screen-status-bar/comment-page-1#comment-2110</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sun, 03 May 2009 02:47:43 +0000</pubDate>
		<guid isPermaLink="false">http://tuxtraining.com/?p=1788#comment-2110</guid>
		<description>ah..lol thanks.  can&#039;t believe i missed that.</description>
		<content:encoded><![CDATA[<p>ah..lol thanks.  can&#8217;t believe i missed that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: emailtoid.net/i/12b407e0/&#8230;</title>
		<link>http://tuxtraining.com/2009/04/29/show-unread-gmails-in-gnu-screen-status-bar/comment-page-1#comment-2109</link>
		<dc:creator>emailtoid.net/i/12b407e0/&#8230;</dc:creator>
		<pubDate>Sun, 03 May 2009 00:25:32 +0000</pubDate>
		<guid isPermaLink="false">http://tuxtraining.com/?p=1788#comment-2109</guid>
		<description>Well here in the gmail_password it has ( instead of {</description>
		<content:encoded><![CDATA[<p>Well here in the gmail_password it has ( instead of {</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://tuxtraining.com/2009/04/29/show-unread-gmails-in-gnu-screen-status-bar/comment-page-1#comment-2108</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sat, 02 May 2009 16:28:50 +0000</pubDate>
		<guid isPermaLink="false">http://tuxtraining.com/?p=1788#comment-2108</guid>
		<description>You wrote
&lt;blockquote&gt;
However the part containing

{gmail_login}:$(gmail_password}

should be

{gmail_login}:${gmail_password}
&lt;/blockquote&gt;
wordpress must be doing something here, b/c those 2 lines are exactly the same.</description>
		<content:encoded><![CDATA[<p>You wrote</p>
<blockquote><p>
However the part containing</p>
<p>{gmail_login}:$(gmail_password}</p>
<p>should be</p>
<p>{gmail_login}:${gmail_password}
</p></blockquote>
<p>wordpress must be doing something here, b/c those 2 lines are exactly the same.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: emailtoid.net/i/12b407e0/…</title>
		<link>http://tuxtraining.com/2009/04/29/show-unread-gmails-in-gnu-screen-status-bar/comment-page-1#comment-2104</link>
		<dc:creator>emailtoid.net/i/12b407e0/…</dc:creator>
		<pubDate>Thu, 30 Apr 2009 17:30:39 +0000</pubDate>
		<guid isPermaLink="false">http://tuxtraining.com/?p=1788#comment-2104</guid>
		<description>Hi Guys,

Liked the script and its a lot better than i could have come up with, however it took me a wee while to make it work, so i thought i would share.  I also made a couple of changes.

Firstly there was a typo in the variable $fetch

it reads;

fetch=&quot;$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q -O - https://${gmail_login}:$(gmail_password}@mail.google.com/mail/feed/atom --no-check-certificate )&quot;

However the part containing 

{gmail_login}:$(gmail_password} 

should be 

{gmail_login}:${gmail_password}

Just a curly bracket needed that was all.  I also noticed in that line that you had an -O in wget but you named it -, i have TBH i just deleted that line, it made things complicated for me, and for me the output was named atom, not sure if that is the same for everyone or if its just cas of the ubuntu and wget i&#039;m using.

Which leads me on to the grep part of the script, due to the output option being - and it not being used in grep it couldn&#039;t find anything i changed the line to this

from;

line=&quot;$(echo &quot;$fetch&quot; &#124; grep &#039;fullcount&#039;)&quot;

to;

line=&quot;$(echo &quot;$fetch&quot; &#124; grep &#039;fullcount&#039; atom)&quot;

Which leads me on the next change i made.  I like the idea of having a message if there wasn&#039;t a any unread messages but what i found was that the if statement would report 0 rather !.  I presume its because the statement in effect is true, 0 is not being counted as null but as number.  So i made the following change

from;

if [ -z &quot;$unread&quot; ]; then

to;

if [ &quot;$unread&quot; == 0 ]; then

My logic was is the condition could only be met by one criteria which is that 0 unread messages 

and i also changed

echo “!”

to;

echo &quot;You Have No Unread Emails $gmail_login&quot;

and added; 

rm atom

to the end of the script to remove un-needed file

So my whole script looks like this now;

#!/bin/bash

# Gmail Vars, must be configured by user

gmail_login=&quot;gmailusername&quot;
gmail_password=&quot;gmailpassword&quot;

# Calls

fetch=&quot;$(wget --secure-protocol=TLSv1 --timeout=3 -t 1 -q https://${gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom --no-check-certificate )&quot;

line=&quot;$(echo &quot;$fetch&quot; &#124; grep &#039;fullcount&#039; atom)&quot;

unread=&quot;$(echo &quot;$line&quot; &#124; sed &quot;s/\(.*\)/\1/&quot;)&quot;

# Checking and displaying unread emails

if [ &quot;$unread&quot; == 0 ]; 

then
	echo &quot;You Have No Unread Emails $gmail_login&quot;
else
	echo &quot;$unread&quot;

fi

# removing un-needed files

rm atom


My tupence worth, please feel free to ignore the changes or build on them but i thought it be only fair seems as you did the donkey work on it to pass my changes back

Yours

Arron AKA finux</description>
		<content:encoded><![CDATA[<p>Hi Guys,</p>
<p>Liked the script and its a lot better than i could have come up with, however it took me a wee while to make it work, so i thought i would share.  I also made a couple of changes.</p>
<p>Firstly there was a typo in the variable $fetch</p>
<p>it reads;</p>
<p>fetch=&#8221;$(wget &#8211;secure-protocol=TLSv1 &#8211;timeout=3 -t 1 -q -O &#8211; <a href="https://$" rel="nofollow">https://$</a>{gmail_login}:$(gmail_password}@mail.google.com/mail/feed/atom &#8211;no-check-certificate )&#8221;</p>
<p>However the part containing </p>
<p>{gmail_login}:$(gmail_password} </p>
<p>should be </p>
<p>{gmail_login}:${gmail_password}</p>
<p>Just a curly bracket needed that was all.  I also noticed in that line that you had an -O in wget but you named it -, i have TBH i just deleted that line, it made things complicated for me, and for me the output was named atom, not sure if that is the same for everyone or if its just cas of the ubuntu and wget i&#8217;m using.</p>
<p>Which leads me on to the grep part of the script, due to the output option being &#8211; and it not being used in grep it couldn&#8217;t find anything i changed the line to this</p>
<p>from;</p>
<p>line=&#8221;$(echo &#8220;$fetch&#8221; | grep &#8216;fullcount&#8217;)&#8221;</p>
<p>to;</p>
<p>line=&#8221;$(echo &#8220;$fetch&#8221; | grep &#8216;fullcount&#8217; atom)&#8221;</p>
<p>Which leads me on the next change i made.  I like the idea of having a message if there wasn&#8217;t a any unread messages but what i found was that the if statement would report 0 rather !.  I presume its because the statement in effect is true, 0 is not being counted as null but as number.  So i made the following change</p>
<p>from;</p>
<p>if [ -z "$unread" ]; then</p>
<p>to;</p>
<p>if [ "$unread" == 0 ]; then</p>
<p>My logic was is the condition could only be met by one criteria which is that 0 unread messages </p>
<p>and i also changed</p>
<p>echo “!”</p>
<p>to;</p>
<p>echo &#8220;You Have No Unread Emails $gmail_login&#8221;</p>
<p>and added; </p>
<p>rm atom</p>
<p>to the end of the script to remove un-needed file</p>
<p>So my whole script looks like this now;</p>
<p>#!/bin/bash</p>
<p># Gmail Vars, must be configured by user</p>
<p>gmail_login=&#8221;gmailusername&#8221;<br />
gmail_password=&#8221;gmailpassword&#8221;</p>
<p># Calls</p>
<p>fetch=&#8221;$(wget &#8211;secure-protocol=TLSv1 &#8211;timeout=3 -t 1 -q <a href="https://$" rel="nofollow">https://$</a>{gmail_login}:${gmail_password}@mail.google.com/mail/feed/atom &#8211;no-check-certificate )&#8221;</p>
<p>line=&#8221;$(echo &#8220;$fetch&#8221; | grep &#8216;fullcount&#8217; atom)&#8221;</p>
<p>unread=&#8221;$(echo &#8220;$line&#8221; | sed &#8220;s/\(.*\)/\1/&#8221;)&#8221;</p>
<p># Checking and displaying unread emails</p>
<p>if [ "$unread" == 0 ]; </p>
<p>then<br />
	echo &#8220;You Have No Unread Emails $gmail_login&#8221;<br />
else<br />
	echo &#8220;$unread&#8221;</p>
<p>fi</p>
<p># removing un-needed files</p>
<p>rm atom</p>
<p>My tupence worth, please feel free to ignore the changes or build on them but i thought it be only fair seems as you did the donkey work on it to pass my changes back</p>
<p>Yours</p>
<p>Arron AKA finux</p>
]]></content:encoded>
	</item>
</channel>
</rss>
