<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MemoSoup &#187; unix</title>
	<atom:link href="http://www.memosoup.com/tag/unix/feed" rel="self" type="application/rss+xml" />
	<link>http://www.memosoup.com</link>
	<description>Mix of the things I always forget</description>
	<lastBuildDate>Tue, 07 Feb 2012 00:03:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>AIX: reset user password</title>
		<link>http://www.memosoup.com/20120130/aix-reset-user-password.html</link>
		<comments>http://www.memosoup.com/20120130/aix-reset-user-password.html#comments</comments>
		<pubDate>Mon, 30 Jan 2012 13:17:54 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[aix]]></category>
		<category><![CDATA[password]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=446</guid>
		<description><![CDATA[<p>Change the password for the user (as root):</p> passwd username <p>Reset the login counter and unlock the user:</p> chsec -f /etc/security/lastlog -a &#34;unsuccessful_login_count=0&#34; -s username chuser &#34;account_locked=false&#34; username Tweet news and informations&#160;automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel]]></description>
			<content:encoded><![CDATA[<p>Change the password for the user (as root):</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">passwd</span> username</div></div>
<p>Reset the login counter and unlock the user:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">chsec <span style="color: #660033;">-f</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>security<span style="color: #000000; font-weight: bold;">/</span>lastlog <span style="color: #660033;">-a</span> <span style="color: #ff0000;">&quot;unsuccessful_login_count=0&quot;</span> <span style="color: #660033;">-s</span> username<br />
chuser <span style="color: #ff0000;">&quot;account_locked=false&quot;</span> username</div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20120130%2Faix-reset-user-password.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20120130/aix-reset-user-password.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="AIX: reset user password" data-url="http://www.memosoup.com/20120130/aix-reset-user-password.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20120130/aix-reset-user-password.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix: print in color</title>
		<link>http://www.memosoup.com/20110130/unix-print-in-color.html</link>
		<comments>http://www.memosoup.com/20110130/unix-print-in-color.html#comments</comments>
		<pubDate>Sun, 30 Jan 2011 14:46:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=334</guid>
		<description><![CDATA[<p>This simple procedure takes 3 arguments as the parameters:</p> Text Foreground color Background color <p>It prints the text to the terminal in selected colors.</p> function print_color &#123; &#160;local text=$1 &#160;local fg=$2 &#160;local bg=$3 &#160;case &#34;$fg&#34; in &#160;red&#41; fg=&#34;31m&#34; ;; &#160;green&#41; fg=&#34;32m&#34; ;; &#160;yellow&#41; fg=&#34;33m&#34; ;; &#160;blue&#41; fg=&#34;34m&#34; ;; &#160;white&#41; fg=&#34;37m&#34; ;; &#160;black&#41; fg=&#34;30m&#34; ;; &#160;*&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>This simple procedure takes 3 arguments as the parameters:</p>
<ul>
<li>Text</li>
<li>Foreground color</li>
<li>Background color</li>
</ul>
<p>It prints the text to the terminal in selected colors.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> print_color <span style="color: #7a0874; font-weight: bold;">&#123;</span> <br />
&nbsp;<span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">text</span>=<span style="color: #007800;">$1</span> <br />
&nbsp;<span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">fg</span>=<span style="color: #007800;">$2</span> <br />
&nbsp;<span style="color: #7a0874; font-weight: bold;">local</span> <span style="color: #007800;">bg</span>=<span style="color: #007800;">$3</span> <br />
&nbsp;<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$fg</span>&quot;</span> <span style="color: #000000; font-weight: bold;">in</span> <br />
&nbsp;<span style="color: #c20cb9; font-weight: bold;">red</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">fg</span>=<span style="color: #ff0000;">&quot;31m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;green<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">fg</span>=<span style="color: #ff0000;">&quot;32m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;yellow<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">fg</span>=<span style="color: #ff0000;">&quot;33m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;blue<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">fg</span>=<span style="color: #ff0000;">&quot;34m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;white<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">fg</span>=<span style="color: #ff0000;">&quot;37m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;black<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">fg</span>=<span style="color: #ff0000;">&quot;30m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">fg</span>=<span style="color: #ff0000;">&quot;37m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;<span style="color: #000000; font-weight: bold;">esac</span> <br />
&nbsp;<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$bg</span>&quot;</span> <span style="color: #000000; font-weight: bold;">in</span> <br />
&nbsp;<span style="color: #c20cb9; font-weight: bold;">red</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">bg</span>=<span style="color: #ff0000;">&quot;41m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;green<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">bg</span>=<span style="color: #ff0000;">&quot;42m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;yellow<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">bg</span>=<span style="color: #ff0000;">&quot;43m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;blue<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">bg</span>=<span style="color: #ff0000;">&quot;44m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;white<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">bg</span>=<span style="color: #ff0000;">&quot;47m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;black<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">bg</span>=<span style="color: #ff0000;">&quot;40m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">bg</span>=<span style="color: #ff0000;">&quot;40m&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span> <br />
&nbsp;<span style="color: #000000; font-weight: bold;">esac</span> <br />
&nbsp;<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #660033;">-en</span> <span style="color: #ff0000;">&quot;\033[<span style="color: #007800;">${fg}</span>\033[<span style="color: #007800;">${bg}</span><span style="color: #007800;">${text}</span>\033[0m&quot;</span> <br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span></div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20110130%2Funix-print-in-color.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20110130/unix-print-in-color.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Unix: print in color" data-url="http://www.memosoup.com/20110130/unix-print-in-color.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20110130/unix-print-in-color.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix: rename files to lowercase</title>
		<link>http://www.memosoup.com/20110130/unix-rename-files-to-lowercase.html</link>
		<comments>http://www.memosoup.com/20110130/unix-rename-files-to-lowercase.html#comments</comments>
		<pubDate>Sun, 30 Jan 2011 14:44:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[case]]></category>
		<category><![CDATA[rename]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=331</guid>
		<description><![CDATA[<p>It&#8217;s very simple to rename the files to lowercase/uppercase using awk:</p> <p>Lowercase</p> ls -1rt &#124; awk '{ printf(&#34;mv %s %s\n&#34;, $0, tolower($0)) &#124; &#34;sh&#34; } END { close(&#34;sh&#34;) }' <p>Uppercase</p> ls -1rt &#124; awk '{ printf(&#34;mv %s %s\n&#34;, $0, toupper($0)) &#124; &#34;sh&#34; } END { close(&#34;sh&#34;) }' Tweet news and informations&#160;automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s very simple to rename the files to lowercase/uppercase using awk:</p>
<p><strong>Lowercase</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-1rt</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ printf(&quot;mv %s %s\n&quot;, $0, tolower($0)) | &quot;sh&quot; } END { close(&quot;sh&quot;) }'</span></div></div>
<p><strong>Uppercase</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-1rt</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ printf(&quot;mv %s %s\n&quot;, $0, toupper($0)) | &quot;sh&quot; } END { close(&quot;sh&quot;) }'</span></div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20110130%2Funix-rename-files-to-lowercase.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20110130/unix-rename-files-to-lowercase.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Unix: rename files to lowercase" data-url="http://www.memosoup.com/20110130/unix-rename-files-to-lowercase.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20110130/unix-rename-files-to-lowercase.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix: get the file date</title>
		<link>http://www.memosoup.com/20090918/unix-get-the-file-date.html</link>
		<comments>http://www.memosoup.com/20090918/unix-get-the-file-date.html#comments</comments>
		<pubDate>Fri, 18 Sep 2009 15:08:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Perl]]></category>
		<category><![CDATA[Unix]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=132</guid>
		<description><![CDATA[ls -1 &#124; cpio -o &#124; cpio -ivt &#124; awk '{print $NF, $(NF-1), $(NF-4), $(NF-3) }' <p>Warning: I/O expensive for the large files!</p> <p>Perl:</p> @a = localtime&#40;&#40;stat&#40;$my_file&#41;&#41;&#91;9&#93;&#41;; $a&#91;4&#93;++; printf &#34;%02d%02d%02d&#34;,@a&#91;5,4,3&#93;; Tweet news and informations&#160;automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel]]></description>
			<content:encoded><![CDATA[<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cpio</span> <span style="color: #660033;">-o</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">cpio</span> <span style="color: #660033;">-ivt</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{print $NF, $(NF-1), $(NF-4), $(NF-3) }'</span></div></div>
<p><strong>Warning: </strong>I/O expensive for the large files!</p>
<p><strong>Perl:</strong></p>
<div class="codecolorer-container perl default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="perl codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0000ff;">@a</span> <span style="color: #339933;">=</span> <a href="http://perldoc.perl.org/functions/localtime.html"><span style="color: #000066;">localtime</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><a href="http://perldoc.perl.org/functions/stat.html"><span style="color: #000066;">stat</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">$my_file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #0000ff;">$a</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">++;</span><br />
<a href="http://perldoc.perl.org/functions/printf.html"><span style="color: #000066;">printf</span></a> <span style="color: #ff0000;">&quot;%02d%02d%02d&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">@a</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span></div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20090918%2Funix-get-the-file-date.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20090918/unix-get-the-file-date.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Unix: get the file date" data-url="http://www.memosoup.com/20090918/unix-get-the-file-date.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20090918/unix-get-the-file-date.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Redirect script output to the log</title>
		<link>http://www.memosoup.com/20090913/redirect-script-output-to-the-log.html</link>
		<comments>http://www.memosoup.com/20090913/redirect-script-output-to-the-log.html#comments</comments>
		<pubDate>Sun, 13 Sep 2009 17:29:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[output]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=87</guid>
		<description><![CDATA[<p>If the whole output of the complex script should be redirected to the log, the following trick could be used.</p> if &#91; &#34;$1&#34; != &#34;-log&#34; &#93; ; then &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;$0 -log &#34;$@&#34; 2&#62;&#38;1 &#124; tee the_log_file.$$.log &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;
&#160; &#160;echo &#34;The log file for the current session: the_log_file.$$.log&#34; &#160;
&#160; &#160;exit 0 &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 
fi &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; 
shift &#160;# remove &#34;-log&#34; parameter
 
				
			 
				
			 
				Tweet 
			
		news and informations&#160;automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel]]></description>
			<content:encoded><![CDATA[<p>If the whole output of the complex script should be redirected to the log, the following trick could be used.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">!</span>= <span style="color: #ff0000;">&quot;-log&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp;<span style="color: #007800;">$0</span> <span style="color: #660033;">-log</span> <span style="color: #ff0000;">&quot;$@&quot;</span> <span style="color: #000000;">2</span><span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">tee</span> the_log_file.<span style="color: #007800;">$$</span>.log &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;The log file for the current session: the_log_file.$$.log&quot;</span> &nbsp;<br />
&nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<span style="color: #000000; font-weight: bold;">fi</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
<span style="color: #7a0874; font-weight: bold;">shift</span> &nbsp;<span style="color: #666666; font-style: italic;"># remove &quot;-log&quot; parameter</span></div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20090913%2Fredirect-script-output-to-the-log.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20090913/redirect-script-output-to-the-log.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Redirect script output to the log" data-url="http://www.memosoup.com/20090913/redirect-script-output-to-the-log.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20090913/redirect-script-output-to-the-log.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>grep in find command: how to display file names</title>
		<link>http://www.memosoup.com/20090913/grep-in-find-command-how-to-display-file-names.html</link>
		<comments>http://www.memosoup.com/20090913/grep-in-find-command-how-to-display-file-names.html#comments</comments>
		<pubDate>Sat, 12 Sep 2009 22:09:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[filename]]></category>
		<category><![CDATA[find]]></category>
		<category><![CDATA[grep]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=73</guid>
		<description><![CDATA[<p>Here is very simple trick to force the grep command to display file name, when it&#8217;s used together with find operation. Just write /dev/null as the &#8220;second file&#8221;</p> <p>find . -type f -exec grep somestring {} /dev/null \;</p> Tweet news and informations&#160;automotive,business,crime,health,life,politics,science,technology,travelautomotive,business,crime,health,life,politics,science,technology,travel]]></description>
			<content:encoded><![CDATA[<p>Here is very simple trick to force the grep command to display file name, when it&#8217;s used together with <strong>find</strong> operation.<br />
Just write <strong>/dev/null</strong> as the &#8220;second file&#8221;</p>
<p>find . -type f -exec grep <em>somestring</em> {} <strong>/dev/null</strong> \;</p>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20090913%2Fgrep-in-find-command-how-to-display-file-names.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20090913/grep-in-find-command-how-to-display-file-names.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="grep in find command: how to display file names" data-url="http://www.memosoup.com/20090913/grep-in-find-command-how-to-display-file-names.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20090913/grep-in-find-command-how-to-display-file-names.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using pattern lists in Unix</title>
		<link>http://www.memosoup.com/20090912/using-pattern-lists-in-unix.html</link>
		<comments>http://www.memosoup.com/20090912/using-pattern-lists-in-unix.html#comments</comments>
		<pubDate>Sat, 12 Sep 2009 18:57:48 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[case]]></category>
		<category><![CDATA[regexp]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=71</guid>
		<description><![CDATA[<p>Here is the small reminder about the syntax of the &#8220;case&#8221; command and the usage of the pattern lists.</p> #!/bin/ksh print -n &#34;Please enter the line: &#34; read line case &#34;$line&#34; in &#160;?&#40;dog&#124;cat&#41; &#160;&#41; print &#34;zero or one occurrence of any pattern&#34; ;; &#160;*&#40;low&#124;high&#41; &#41; print &#34;zero or more occurrences of any pattern&#34; ;; &#160;@&#40;duncan&#124;methos&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the small reminder about the syntax of the &#8220;case&#8221; command and the usage of the pattern lists.</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/ksh</span><br />
print <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;Please enter the line: &quot;</span><br />
<span style="color: #c20cb9; font-weight: bold;">read</span> line<br />
<br />
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$line</span>&quot;</span> <span style="color: #000000; font-weight: bold;">in</span><br />
&nbsp;?<span style="color: #7a0874; font-weight: bold;">&#40;</span>dog<span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">cat</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp;<span style="color: #7a0874; font-weight: bold;">&#41;</span> print <span style="color: #ff0000;">&quot;zero or one occurrence of any pattern&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>low<span style="color: #000000; font-weight: bold;">|</span>high<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> print <span style="color: #ff0000;">&quot;zero or more occurrences of any pattern&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>duncan<span style="color: #000000; font-weight: bold;">|</span>methos<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> print <span style="color: #ff0000;">&quot;exactly one occurrence of any pattern&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp;+<span style="color: #7a0874; font-weight: bold;">&#40;</span>rudolph<span style="color: #000000; font-weight: bold;">|</span>blitzen<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> print <span style="color: #ff0000;">&quot;one or more occurrence of any pattern&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">!</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>grinch<span style="color: #000000; font-weight: bold;">|</span>babay<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> print <span style="color: #ff0000;">&quot;everything except patterns&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp;-<span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>hH?<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp;print <span style="color: #ff0000;">&quot;Some help...&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp;-v<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>erbose<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> print <span style="color: #ff0000;">&quot;Some more words...&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span><br />
&nbsp;<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> print <span style="color: #ff0000;">&quot;Something else...&quot;</span> <span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #000000; font-weight: bold;">esac</span></div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20090912%2Fusing-pattern-lists-in-unix.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20090912/using-pattern-lists-in-unix.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Using pattern lists in Unix" data-url="http://www.memosoup.com/20090912/using-pattern-lists-in-unix.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20090912/using-pattern-lists-in-unix.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Print the PATH directories in the readable format</title>
		<link>http://www.memosoup.com/20090912/print-the-path-directories-in-the-readable-format.html</link>
		<comments>http://www.memosoup.com/20090912/print-the-path-directories-in-the-readable-format.html#comments</comments>
		<pubDate>Sat, 12 Sep 2009 18:55:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Unix]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[output]]></category>
		<category><![CDATA[PATH]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=69</guid>
		<description><![CDATA[echo $PATH&#124; awk -v RS=&#34;:&#34; '{ print $0 }' echo $LD_LIBRARY_PATH &#124;awk -v RS=&#34;:&#34; '{ system ( &#34;ls -rltd &#34; $0 ) }' <p>Warning! As far as the option &#8216;-v&#8217; is used, the new awk(nawk in some systems) should be used.</p> <p>To check if the new version of awk is installed:</p> awk 1 /dev/null <p>The [...]]]></description>
			<content:encoded><![CDATA[<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$PATH</span><span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-v</span> <span style="color: #007800;">RS</span>=<span style="color: #ff0000;">&quot;:&quot;</span> <span style="color: #ff0000;">'{ print $0 }'</span><br />
<br />
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$LD_LIBRARY_PATH</span> <span style="color: #000000; font-weight: bold;">|</span><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #660033;">-v</span> <span style="color: #007800;">RS</span>=<span style="color: #ff0000;">&quot;:&quot;</span> <span style="color: #ff0000;">'{ system ( &quot;ls -rltd &quot; $0 ) }'</span></div></div>
<p><em>Warning!</em><br />
As far as the option &#8216;-v&#8217; is used, the new awk(<strong>nawk</strong> in some systems) should be used.</p>
<p>To check if the new version of awk is installed:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>null</div></div>
<p>The output will be empty for new awk.<br />
You have the old awk, if the output is something like</p>
<blockquote><p>
awk: syntax error near line 1
</p></blockquote>
<p>In this case <strong>nawk</strong> should be used instead <strong>awk</strong></p>
<p><strong>MS-DOS</strong> modification: echo %PATH% | awk -v RS=&#8221;;&#8221; &#8220;{ print $0 }&#8221;</p>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20090912%2Fprint-the-path-directories-in-the-readable-format.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20090912/print-the-path-directories-in-the-readable-format.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Print the PATH directories in the readable format" data-url="http://www.memosoup.com/20090912/print-the-path-directories-in-the-readable-format.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20090912/print-the-path-directories-in-the-readable-format.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Parsing script parameters</title>
		<link>http://www.memosoup.com/20090912/parsing-script-parameters.html</link>
		<comments>http://www.memosoup.com/20090912/parsing-script-parameters.html#comments</comments>
		<pubDate>Sat, 12 Sep 2009 15:26:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[parameters]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=44</guid>
		<description><![CDATA[<p>Quick and dirty parsing procedure for unix shell scripts</p> parse_command_line &#40;&#41; &#123; typeset -i user_opt help_opt password_opt verbose_opt typeset errmsg arg_cou=$# while &#91; &#34;$#&#34; -gt 0 &#93; do &#60;strong&#62;case &#34;$1&#34; in&#60;/strong&#62; -@&#40;&#91;U&#93;&#41; &#41; &#160;let user_opt=user_opt+1 ;; -P &#160; &#160; &#160; &#41; &#160; &#160;let password_opt=password_opt+1 ; ask_pass=0 ;; -option1 &#160; &#160;&#41; &#160; &#160;;; -option2 &#160; &#160;&#41; [...]]]></description>
			<content:encoded><![CDATA[<p>Quick and dirty <strong>parsing</strong> procedure for unix <strong>shell scripts</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">parse_command_line <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #7a0874; font-weight: bold;">&#123;</span><br />
<span style="color: #7a0874; font-weight: bold;">typeset</span> <span style="color: #660033;">-i</span> user_opt help_opt password_opt verbose_opt<br />
<span style="color: #7a0874; font-weight: bold;">typeset</span> errmsg<br />
<br />
<span style="color: #007800;">arg_cou</span>=<span style="color: #007800;">$#</span><br />
<br />
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #ff0000;">&quot;$#&quot;</span> <span style="color: #660033;">-gt</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span><br />
<span style="color: #000000; font-weight: bold;">do</span><br />
<span style="color: #000000; font-weight: bold;">&lt;</span>strong<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span><span style="color: #000000; font-weight: bold;">&lt;/</span>strong<span style="color: #000000; font-weight: bold;">&gt;</span><br />
-<span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>U<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp;<span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #007800;">user_opt</span>=user_opt+<span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #660033;">-P</span> &nbsp; &nbsp; &nbsp; <span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #007800;">password_opt</span>=password_opt+<span style="color: #000000;">1</span> ; <span style="color: #007800;">ask_pass</span>=<span style="color: #000000;">0</span> <span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #660033;">-option1</span> &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #660033;">-option2</span> &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #660033;">-option3</span> &nbsp; &nbsp;<span style="color: #7a0874; font-weight: bold;">&#41;</span> &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">;;</span><br />
-<span style="color: #000000; font-weight: bold;">@</span><span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>hH?<span style="color: #7a0874; font-weight: bold;">&#93;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #007800;">help_opt</span>=<span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">;;</span><br />
-v<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#40;</span>erbose<span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">let</span> <span style="color: #007800;">verbose_opt</span>=verbose_opt+<span style="color: #000000;">1</span> <span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #000000; font-weight: bold;">if</span> &nbsp; <span style="color: #7a0874; font-weight: bold;">&#91;</span> user_opt <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span><br />
<span style="color: #007800;">USER</span>=<span style="color: #ff0000;">&quot;$1&quot;</span>; <span style="color: #007800;">user_opt</span>=<span style="color: #000000;">0</span><br />
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> password_opt <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span><br />
<span style="color: #007800;">PASS</span>=<span style="color: #ff0000;">&quot;$1&quot;</span>; <span style="color: #007800;">password_opt</span>=<span style="color: #000000;">0</span><br />
<span style="color: #000000; font-weight: bold;">elif</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> verbose_opt <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>;<span style="color: #000000; font-weight: bold;">then</span><br />
<span style="color: #007800;">verbose_level</span>=<span style="color: #ff0000;">&quot;$1&quot;</span>; <span style="color: #007800;">verbose_opt</span>=<span style="color: #000000;">0</span><br />
<span style="color: #000000; font-weight: bold;">else</span><br />
<span style="color: #666666; font-style: italic;">### help_opt=1</span><br />
<span style="color: #007800;">CMD</span>=<span style="color: #007800;">$*</span> ; <span style="color: #7a0874; font-weight: bold;">break</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #000000; font-weight: bold;">;;</span><br />
<span style="color: #000000; font-weight: bold;">esac</span><br />
<span style="color: #7a0874; font-weight: bold;">shift</span><br />
<span style="color: #000000; font-weight: bold;">done</span><br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> arg_cou <span style="color: #660033;">-eq</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span><br />
<span style="color: #007800;">help_opt</span>=<span style="color: #000000;">1</span> ; <span style="color: #007800;">errmsg</span>=<span style="color: #ff0000;">&quot;Nothing to do&quot;</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
<span style="color: #000000; font-weight: bold;">for</span> opt <span style="color: #000000; font-weight: bold;">in</span> user password ; <span style="color: #000000; font-weight: bold;">do</span><br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #800000;">${opt}</span>_opt <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span><br />
<span style="color: #007800;">help_opt</span>=<span style="color: #000000;">1</span> ; <span style="color: #007800;">errmsg</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">${errmsg}</span><span style="color: #000099; font-weight: bold;">\n</span><span style="color: #007800;">${opt}</span> is absent&quot;</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #000000; font-weight: bold;">done</span><br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> verbose_opt <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span><br />
<span style="color: #007800;">verbose_level</span>=<span style="color: #007800;">$verbose_opt</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<br />
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> help_opt <span style="color: #660033;">-eq</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span><br />
<span style="color: #7a0874; font-weight: bold;">help</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$errmsg</span>&quot;</span><br />
<span style="color: #000000; font-weight: bold;">fi</span><br />
<span style="color: #7a0874; font-weight: bold;">&#125;</span></div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20090912%2Fparsing-script-parameters.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20090912/parsing-script-parameters.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Parsing script parameters" data-url="http://www.memosoup.com/20090912/parsing-script-parameters.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20090912/parsing-script-parameters.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rev function and comma-separated output</title>
		<link>http://www.memosoup.com/20090912/rev-function-and-comma-separated-output.html</link>
		<comments>http://www.memosoup.com/20090912/rev-function-and-comma-separated-output.html#comments</comments>
		<pubDate>Fri, 11 Sep 2009 23:26:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Scripts]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[output]]></category>
		<category><![CDATA[unix]]></category>

		<guid isPermaLink="false">http://www.memosoup.com/?p=27</guid>
		<description><![CDATA[<p>Here is the shell command snippet to display comma-separated output:</p> ls -lrt &#124; rev &#124; sed 's/\\([0-9][0-9][0-9]\\)/\\1,/g' &#124; rev &#124; sed 's/\\([\^0-9]\\),\\([0-9]\\)/\\1\\2/g;s/\^,\\([0-9]\\)/\\1/g' <p>Example: -rw-r&#8212;&#8211; 1 sybase dba 1,572,872,192 Feb 2 07:09 master.dbf</p> <p>Rev in awk</p> #!/bin/ksh nawk '{ l=length($0) ; for(i=l;i&#62;0;i--) { printf &#34;%s&#34;, substr($0,i,1) } ; print &#34;&#34; }' <p>Rev function (absent on SunOS) [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the shell command snippet to display <strong>comma-separated</strong> output:</p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #660033;">-lrt</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">rev</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/\\([0-9][0-9][0-9]\\)/\\1,/g'</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">rev</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #ff0000;">'s/\\([\^0-9]\\),\\([0-9]\\)/\\1\\2/g;s/\^,\\([0-9]\\)/\\1/g'</span></div></div>
<p><strong>Example:</strong><br />
-rw-r&#8212;&#8211;   1 sybase   dba   <strong>1,572,872,192</strong> Feb  2 07:09 master.dbf</p>
<p><strong>Rev in awk</strong></p>
<div class="codecolorer-container bash default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">#!/bin/ksh</span><br />
<span style="color: #c20cb9; font-weight: bold;">nawk</span> <span style="color: #ff0000;">'{ l=length($0) ; for(i=l;i&gt;0;i--) { printf &quot;%s&quot;, substr($0,i,1) } ; print &quot;&quot; }'</span></div></div>
<p><strong>Rev</strong> function (absent on SunOS) :</p>
<p>(<em>Warning!</em> Avoid spaces before #define &#8211; SunOS cc compiler doesn&#8217;t like them)</p>
<div class="codecolorer-container c default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:100%;"><div class="c codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">#include &lt;stdio.h&gt;</span><br />
<span style="color: #339933;">#ident &nbsp;&quot;@(#)rev 1.0 &nbsp; &nbsp; 02/01/2006&quot;</span><br />
<span style="color: #339933;">#define MAX_STRING_SIZE 2000char version[] = &quot;rev v1.0 02/01/2006&quot;;</span><br />
<br />
main<span style="color: #009900;">&#40;</span>argc<span style="color: #339933;">,</span>argv<span style="color: #009900;">&#41;</span><br />
<span style="color: #993333;">int</span> argc<span style="color: #339933;">;</span><br />
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span>argv<span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#123;</span><br />
<span style="color: #993333;">char</span> my_src<span style="color: #009900;">&#91;</span>MAX_STRING_SIZE<span style="color: #009900;">&#93;</span> <span style="color: #339933;">;</span><br />
<span style="color: #993333;">char</span> my_dst<span style="color: #009900;">&#91;</span>MAX_STRING_SIZE<span style="color: #009900;">&#93;</span> <span style="color: #339933;">;</span><br />
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span>retCode <span style="color: #339933;">;</span><br />
<br />
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span>tmp_s <span style="color: #339933;">;</span><br />
<span style="color: #993333;">int</span> i<span style="color: #339933;">;</span><br />
<br />
<span style="color: #993333;">char</span> <span style="color: #339933;">*</span>filename<span style="color: #339933;">;</span><br />
FILE <span style="color: #339933;">*</span>fSource <span style="color: #339933;">;</span><br />
<br />
<span style="color: #808080; font-style: italic;">/* check command line arguments */</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>argc <span style="color: #339933;">&gt;</span> <span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #ff0000;">'-'</span> <span style="color: #339933;">||</span> argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">==</span><span style="color: #ff0000;">'/'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<a href="http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html"><span style="color: #000066;">fprintf</span></a><span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Usage: %s [file] <span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html"><span style="color: #000066;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
filename<span style="color: #339933;">=</span>argv<span style="color: #009900;">&#91;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">;</span><br />
fSource <span style="color: #339933;">=</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/fopen.html"><span style="color: #000066;">fopen</span></a><span style="color: #009900;">&#40;</span> filename<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;r&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> fSource <span style="color: #339933;">==</span> NULL <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<a href="http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html"><span style="color: #000066;">fprintf</span></a><span style="color: #009900;">&#40;</span>stderr<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;Can't open %s for reading<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> filename <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html"><span style="color: #000066;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #808080; font-style: italic;">/* Using the standard input */</span><br />
fSource<span style="color: #339933;">=</span>stdin <span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #808080; font-style: italic;">/* if (argc &gt; 1) */</span><br />
<br />
<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>retCode <span style="color: #339933;">=</span> <a href="http://www.opengroup.org/onlinepubs/009695399/functions/fgets.html"><span style="color: #000066;">fgets</span></a><span style="color: #009900;">&#40;</span> my_src<span style="color: #339933;">,</span> MAX_STRING_SIZE<span style="color: #339933;">,</span> fSource <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">!=</span>NULL <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
tmp_s<span style="color: #339933;">=</span>my_dst<span style="color: #339933;">+</span>MAX_STRING_SIZE<span style="color: #339933;">-</span><span style="color: #0000dd;">1</span><span style="color: #339933;">;</span><br />
<span style="color: #339933;">*</span>tmp_s<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span> i<span style="color: #339933;">=</span><span style="color: #0000dd;">0</span> <span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> MAX_STRING_SIZE <span style="color: #339933;">&amp;&amp;</span> my_src<span style="color: #009900;">&#91;</span> i <span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000dd;">0</span> <span style="color: #339933;">;</span> i<span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> my_src<span style="color: #009900;">&#91;</span> i <span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #ff0000;">'<span style="color: #000099; font-weight: bold;">\n</span>'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<span style="color: #b1b100;">continue</span> <span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
tmp_s<span style="color: #339933;">--;</span><br />
<span style="color: #339933;">*</span>tmp_s<span style="color: #339933;">=</span>my_src<span style="color: #009900;">&#91;</span> i <span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<a href="http://www.opengroup.org/onlinepubs/009695399/functions/fprintf.html"><span style="color: #000066;">fprintf</span></a><span style="color: #009900;">&#40;</span> stdout<span style="color: #339933;">,</span> <span style="color: #ff0000;">&quot;%s<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> tmp_s<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<a href="http://www.opengroup.org/onlinepubs/009695399/functions/fclose.html"><span style="color: #000066;">fclose</span></a><span style="color: #009900;">&#40;</span> fSource <span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span><br />
<br />
<a href="http://www.opengroup.org/onlinepubs/009695399/functions/fflush.html"><span style="color: #000066;">fflush</span></a><span style="color: #009900;">&#40;</span> stdout <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<a href="http://www.opengroup.org/onlinepubs/009695399/functions/exit.html"><span style="color: #000066;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #808080; font-style: italic;">/* main */</span></div></div>
<div style="height:33px; padding-top:2px; padding-bottom:2px; clear:both;" class="zare366"><div style="float:left; width:100px; " class="zare366_facebook_like"> 
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.memosoup.com%2F20090912%2Frev-function-and-comma-separated-output.html&amp;layout=button_count&amp;show_faces=false&amp;width=100&amp;action=like&amp;colorscheme=light&amp;height=27" 
					scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:100px; height:27px;" allowTransparency="true"></iframe>
			</div><div style="float:left; width:90px; padding-left:10px;" class="zare366_google1"> 
				<g:plusone size="medium" href="http://www.memosoup.com/20090912/rev-function-and-comma-separated-output.html" ></g:plusone>
			</div><div style="float:left; width:110px; padding-left:10px;" class="zare366_twitter"> 
				<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
					data-text="Rev function and comma-separated output" data-url="http://www.memosoup.com/20090912/rev-function-and-comma-separated-output.html">Tweet</a> 
			</div></div>
		<div style="display:none;"><a href="http://www.news365live.com">news and informations</a>&nbsp;<a href="http://news365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a><a href="http://worldnews365online.com">automotive,business,crime,health,life,politics,science,technology,travel</a></div><div style="clear:both;"></div>]]></content:encoded>
			<wfw:commentRss>http://www.memosoup.com/20090912/rev-function-and-comma-separated-output.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

