<?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>UKoom &#187; IT Consultant</title>
	<atom:link href="http://www.ukoom.com/category/consultant/feed" rel="self" type="application/rss+xml" />
	<link>http://www.ukoom.com</link>
	<description>Documentum, SharePoint, Alfresco, ECM...</description>
	<lastBuildDate>Thu, 13 May 2010 00:21:48 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Lotus Notes and Domino</title>
		<link>http://www.ukoom.com/lotus-notes-and-domino.htm</link>
		<comments>http://www.ukoom.com/lotus-notes-and-domino.htm#comments</comments>
		<pubDate>Thu, 04 Mar 2010 13:44:09 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[IT Consultant]]></category>
		<category><![CDATA[Computer]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=1051</guid>
		<description><![CDATA[Download a free [...]]]></description>
			<content:encoded><![CDATA[<p>Download a free trial version of IBM® Lotus Notes® 8 software &#8212;  showcasing a modern, Web-like look-and-feel in a familiar Lotus Notes  client format. It’s visually appealing, highly consistent and feature  rich. Offering e-mail, calendar and scheduling, personal journal, to-do  lists, support for innovative business solutions and a set of  productivity tools &#8212; all within a single interface, in the context of  the work you&#8217;re doing &#8212; IBM Lotus Notes 8 software helps you work  smarter, presenting the tools you need, when and where you need them.</p>
<p>IBM Lotus Domino Designer is application development software that  enables application developers and Web site designers to rapidly build,  test and deploy security-rich, multi-platform collaborative and business  applications. An easy to use template model, integrated authentication,  and drag-and-drop assembly features are a small set of the capabilities  available in this high productivity application development  environment. Plus, Lotus Domino Designer 8 software dramatically expands  the development methodologies available, providing you with even more  choice and flexibility when building your business solutions.</p>
<p>IBM Lotus Domino Administrator is client software for system  administrators that allows you to configure, monitor, and administer  Lotus Domino servers locally or remotely.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.ukoom.com/windows-server-2008-r2-hyper-v.htm" title="Windows server 2008 R2 Hyper-v">Windows server 2008 R2 Hyper-v</a></li><li><a href="http://www.ukoom.com/windows-server-2008-hyper-v.htm" title="Windows server 2008 Hyper-v">Windows server 2008 Hyper-v</a></li><li><a href="http://www.ukoom.com/hyper-v-server-2008.htm" title="Hyper-V Server 2008">Hyper-V Server 2008</a></li><li><a href="http://www.ukoom.com/keep-with-next-ms-word.htm" title="Keep With Next: MS Word">Keep With Next: MS Word</a></li><li><a href="http://www.ukoom.com/convert-microsoft-xps-document-to-pdf.htm" title="Convert Microsoft XPS Document To PDF ">Convert Microsoft XPS Document To PDF </a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/lotus-notes-and-domino.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Platform Status: libjvm.so: cannot open shared object file: No such file or directory</title>
		<link>http://www.ukoom.com/platform-status-libjvm-so-cannot-open-shared-object-file-no-such-file-or-directory.htm</link>
		<comments>http://www.ukoom.com/platform-status-libjvm-so-cannot-open-shared-object-file-no-such-file-or-directory.htm#comments</comments>
		<pubDate>Fri, 29 Jan 2010 13:46:43 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Documentum]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=1034</guid>
		<description><![CDATA[Error &#8221;
Generic Status: [...]]]></description>
			<content:encoded><![CDATA[<p>Error &#8221;</p>
<p>Generic Status: Library Open failed, Library Name: /dctm65/shared/java/1.5.0_12/jre/lib/i386/libjava.so, Platform Status: libjvm.so: cannot open shared object file: No such file or directory</p>
<p>IDQL failed to run.  dmAPIInit() returned a failed status.</p>
<p>&#8221; was thrown when executing IDQL command.</p>
<p>I came across this issue after I installed one docbase on linux server.</p>
<p>It seemed that IDQL read the .so file in the wrong place.</p>
<p>I used the link command to resolve this problem:</p>
<p>ln -s /dctm65/shared/java/1.5.0_12/jre/lib/i386/server/libjvm.so /dctm65/shared/java/1.5.0_12/jre/lib/i386/libjvm.so</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.ukoom.com/check-in-v-s-save.htm" title="Check in v.s. Save">Check in v.s. Save</a></li><li><a href="http://www.ukoom.com/dm_query_e_table_no_access.htm" title="DM_QUERY_E_TABLE_NO_ACCESS">DM_QUERY_E_TABLE_NO_ACCESS</a></li><li><a href="http://www.ukoom.com/locate-the-rendition-files.htm" title="Locate the rendition files">Locate the rendition files</a></li><li><a href="http://www.ukoom.com/chown-change-the-owner-of-a-file.htm" title="chown &#8211; change the owner of a file">chown &#8211; change the owner of a file</a></li><li><a href="http://www.ukoom.com/an-internal-virtual-machine-error-13-has-occurred.htm" title="An internal virtual machine error (13) has occurred">An internal virtual machine error (13) has occurred</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/platform-status-libjvm-so-cannot-open-shared-object-file-no-such-file-or-directory.htm/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>chown &#8211; change the owner of a file</title>
		<link>http://www.ukoom.com/chown-change-the-owner-of-a-file.htm</link>
		<comments>http://www.ukoom.com/chown-change-the-owner-of-a-file.htm#comments</comments>
		<pubDate>Thu, 28 Jan 2010 05:34:21 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=1031</guid>
		<description><![CDATA[You can change [...]]]></description>
			<content:encoded><![CDATA[<p>You can change the owner  and group of a file or a directory with the <code>chown</code> command.  Please, keep in mind you can do this only if you are the root user or  the owner of the file.</p>
<p>Set the file&#8217;s owner:<br />
<span><code>$ <strong>chown username somefile</strong></code></span><br />
After giving this command, the new owner of a file called <code>somefile</code> will be the user <code>username</code>. The file&#8217;s group owner will not  change. Instead of a user name, you can also give the user&#8217;s numeric ID  here if you want.</p>
<p>You can also set the file&#8217;s group at the same time. If the user  name is followed by a colon and a group name, the file&#8217;s group will be  changed as well.<br />
<span><code>$ <strong>chown username:usergroup  somefile</strong></code></span><br />
After giving this command, <code>somefile</code>&#8217;s new owner would be  user <code>username</code> and the group <code>usergroup</code>.</p>
<p>You can set the owner of a directory exactly the same way you set  the owner of a file:<br />
<span><code>$ <strong>chown username somedir</strong></code></span><br />
Note that after giving this command, only the owner of the <em>directory</em> will change. The owner of the files <em>inside</em> of the directory  won&#8217;t change.</p>
<p>In order to set the ownership of a directory and all the files in  that directory, you&#8217;ll need the <code>-R</code> option:<br />
<span><code>$ <strong>chown -R username somedir</strong></code></span><br />
Here, R stands for <em>recursive</em> because this command will  recursively change the ownership of directories and their contents.  After issuing this example command, the user <code>username</code> will  be the owner of the directory <code>somedir</code>, as well as every  file in that directory.</p>
<p>Tell what happens:</p>
<p><code>$ <strong>chown -v username somefile</strong><br />
changed ownership of 'somefile' to username</code></p>
<p>Here, v stands for <em>verbose</em>. If you use the <code>-v</code> option, <code>chown</code> will list what it did (or didn&#8217;t do) to the  file.</p>
<p>The verbose mode is especially useful if you change the ownership  of several files at once. For example, this could happen when you do it  recursively:</p>
<p><code>$ <strong>chown -Rv username somedir</strong><br />
changed ownership of 'somedir/' to username<br />
changed ownership of 'somedir/boringfile' to username<br />
changed ownership of 'somedir/somefile' to username</code></p>
<p>As you can see, <code>chown</code> nicely reports to you what it  did to each file.</p>
<div>
<div>
<h2>&lt; <strong><span id="chgrp">chgrp  &#8211; change the group ownership of a file</span></strong> &gt;</h2>
<p>In addition to <code>chown</code>, you can also use the <code>chgrp</code> command to change the group of a file or a directory. You must, again,  be either the root user or the owner of the file in order to change the  group ownership.</p>
<p><code>chgrp</code> works pretty much the same way as <code>chown</code> does, except it changes the file&#8217;s user group instead of the owner, of  course.<br />
<span><code>$ <strong>chgrp usergroup somefile</strong></code></span><br />
After issuing this command, the file <code>somefile</code> will be  owned by a user group <code>usergroup</code>. Although the file&#8217;s group  has changed to <code>usergroup</code>, the file&#8217;s owner will still be  the same.</p>
<p>The options of using <code>chgrp</code> are the same as using <code>chown</code>.  So, for example, the <code>-R</code> and <code>-v</code> options will  work with it just like they worked with <code>chown</code>:</p>
<p><code>$ <strong>chgrp -Rv usergroup somedir</strong><br />
changed group of 'somedir/' to usergroup<br />
changed group of 'somedir/boringfile' to usergroup<br />
changed group of 'somedir/somefile' to usergroup</code></p>
<p><code>chown</code> nicely reports to you what it did to each file.</div>
</div>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.ukoom.com/platform-status-libjvm-so-cannot-open-shared-object-file-no-such-file-or-directory.htm" title="Platform Status: libjvm.so: cannot open shared object file: No such file or directory">Platform Status: libjvm.so: cannot open shared object file: No such file or directory</a></li><li><a href="http://www.ukoom.com/an-internal-virtual-machine-error-13-has-occurred.htm" title="An internal virtual machine error (13) has occurred">An internal virtual machine error (13) has occurred</a></li><li><a href="http://www.ukoom.com/linux-find-files-containing-text.htm" title="Linux Find Files Containing Text ">Linux Find Files Containing Text </a></li><li><a href="http://www.ukoom.com/if-else-in-bash-of-linux.htm" title="IF Else in bash of linux">IF Else in bash of linux</a></li><li><a href="http://www.ukoom.com/copy-and-paste-in-vi.htm" title="Copy and Paste in VI">Copy and Paste in VI</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/chown-change-the-owner-of-a-file.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An internal virtual machine error (13) has occurred</title>
		<link>http://www.ukoom.com/an-internal-virtual-machine-error-13-has-occurred.htm</link>
		<comments>http://www.ukoom.com/an-internal-virtual-machine-error-13-has-occurred.htm#comments</comments>
		<pubDate>Thu, 28 Jan 2010 04:13:29 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=1028</guid>
		<description><![CDATA[when I booted [...]]]></description>
			<content:encoded><![CDATA[<p>when I booted the Red Hat WS 4 image, I received the following error:  &#8220;An internal virtual machine error (13) has occurred.  The virtual  machine will reset now.&#8221;</p>
<p>To resolve this error, first boot in single user mode:</p>
<ol>
<li>In  GRUB menu select Red Hat Linux with the version of the kernel that you  wish to boot and type <strong>e</strong> for edit. You will be presented  with a list of items in the configuration file for the title you just  selected.</li>
<li>Select the line that starts with kernel and type <strong>e</strong> to edit the line.</li>
<li>Go to the end of the line and type <strong>single</strong> as a separate word. Press enter to exit edit mode.</li>
<li>Back at  the GRUB screen, type <strong>b </strong>to boot into single user mode.</li>
</ol>
<p>Next, edit /etc/X11/xorg.conf and replace set the  Driver to &#8220;vesa&#8221;.  Also, set the DefaultDepth to 16 from 24.  The  implementation of the S3 hardware doesn&#8217;t support a colordepth of 24 and  will cause the error 13.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.ukoom.com/platform-status-libjvm-so-cannot-open-shared-object-file-no-such-file-or-directory.htm" title="Platform Status: libjvm.so: cannot open shared object file: No such file or directory">Platform Status: libjvm.so: cannot open shared object file: No such file or directory</a></li><li><a href="http://www.ukoom.com/chown-change-the-owner-of-a-file.htm" title="chown &#8211; change the owner of a file">chown &#8211; change the owner of a file</a></li><li><a href="http://www.ukoom.com/linux-find-files-containing-text.htm" title="Linux Find Files Containing Text ">Linux Find Files Containing Text </a></li><li><a href="http://www.ukoom.com/if-else-in-bash-of-linux.htm" title="IF Else in bash of linux">IF Else in bash of linux</a></li><li><a href="http://www.ukoom.com/copy-and-paste-in-vi.htm" title="Copy and Paste in VI">Copy and Paste in VI</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/an-internal-virtual-machine-error-13-has-occurred.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux Find Files Containing Text</title>
		<link>http://www.ukoom.com/linux-find-files-containing-text.htm</link>
		<comments>http://www.ukoom.com/linux-find-files-containing-text.htm#comments</comments>
		<pubDate>Wed, 27 Jan 2010 05:54:48 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=1023</guid>
		<description><![CDATA[Find files that [...]]]></description>
			<content:encoded><![CDATA[<p>Find files that contain a text string:</p>
<p>grep -lir &#8220;some text&#8221; *</p>
<p>The -l switch outputs only the names of files in which the text occurs (instead of each line containing the text), the -i switch ignores the case, and the -r descends into subdirectories.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.ukoom.com/platform-status-libjvm-so-cannot-open-shared-object-file-no-such-file-or-directory.htm" title="Platform Status: libjvm.so: cannot open shared object file: No such file or directory">Platform Status: libjvm.so: cannot open shared object file: No such file or directory</a></li><li><a href="http://www.ukoom.com/chown-change-the-owner-of-a-file.htm" title="chown &#8211; change the owner of a file">chown &#8211; change the owner of a file</a></li><li><a href="http://www.ukoom.com/an-internal-virtual-machine-error-13-has-occurred.htm" title="An internal virtual machine error (13) has occurred">An internal virtual machine error (13) has occurred</a></li><li><a href="http://www.ukoom.com/if-else-in-bash-of-linux.htm" title="IF Else in bash of linux">IF Else in bash of linux</a></li><li><a href="http://www.ukoom.com/copy-and-paste-in-vi.htm" title="Copy and Paste in VI">Copy and Paste in VI</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/linux-find-files-containing-text.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Set outlook to receive mails automatically</title>
		<link>http://www.ukoom.com/set-outlook-to-receive-mails-automatically.htm</link>
		<comments>http://www.ukoom.com/set-outlook-to-receive-mails-automatically.htm#comments</comments>
		<pubDate>Wed, 06 Jan 2010 03:44:59 +0000</pubDate>
		<dc:creator>Murphy</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Office]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=997</guid>
		<description><![CDATA[1.工具-&#62;选项

2.选择“邮件设置”选项卡

3.点“发送/接收(S)…”按钮

4.点“编辑”按钮

将不需要和不能在公司内部接收的账户去除（比如公司邮箱外部接收的账户）
Related PostsKeep With [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left">1.工具-&gt;选项</p>
<p style="text-align: left"><a href="http://www.ukoom.com/wp-content/uploads/2010/01/3.jpg"></a><a href="http://www.ukoom.com/wp-content/uploads/2010/01/1.jpg"><img class="alignnone size-full wp-image-998" src="http://www.ukoom.com/wp-content/uploads/2010/01/1.jpg" alt="1" width="375" height="374" /></a><a href="http://www.ukoom.com/wp-content/uploads/2010/01/2.jpg"></a></p>
<p style="text-align: left">2.选择“邮件设置”选项卡</p>
<p><img class="size-full wp-image-999 alignnone" src="http://www.ukoom.com/wp-content/uploads/2010/01/2.jpg" alt="2" width="502" height="543" /></p>
<p>3.点“发送/接收(S)…”按钮</p>
<p><a href="http://www.ukoom.com/wp-content/uploads/2010/01/3.jpg"><img class="alignnone size-full wp-image-1000" src="http://www.ukoom.com/wp-content/uploads/2010/01/3.jpg" alt="3" width="468" height="482" /></a></p>
<p style="text-align: left">4.点“编辑”按钮</p>
<p style="text-align: left"><a href="http://www.ukoom.com/wp-content/uploads/2010/01/4.jpg"><img class="alignnone size-full wp-image-1001" src="http://www.ukoom.com/wp-content/uploads/2010/01/4.jpg" alt="4" width="635" height="483" /></a></p>
<p style="text-align: left">将不需要和不能在公司内部接收的账户去除（比如公司邮箱外部接收的账户）</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.ukoom.com/keep-with-next-ms-word.htm" title="Keep With Next: MS Word">Keep With Next: MS Word</a></li><li><a href="http://www.ukoom.com/convert-microsoft-xps-document-to-pdf.htm" title="Convert Microsoft XPS Document To PDF ">Convert Microsoft XPS Document To PDF </a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/set-outlook-to-receive-mails-automatically.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Do not show password in windows console use cmd commands</title>
		<link>http://www.ukoom.com/do-not-show-password-in-windows-console.htm</link>
		<comments>http://www.ukoom.com/do-not-show-password-in-windows-console.htm#comments</comments>
		<pubDate>Mon, 04 Jan 2010 03:38:25 +0000</pubDate>
		<dc:creator>Murphy</dc:creator>
				<category><![CDATA[Computer]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=994</guid>
		<description><![CDATA[echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5x&#62;in.com
set /p [...]]]></description>
			<content:encoded><![CDATA[<p>echo hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5x&gt;in.com<br />
set /p password=Password:&lt;nul<br />
for /f &#8220;tokens=*&#8221; %%i in (&#8217;in.com&#8217;) do set password=%%i<br />
del in.com</p>
<p>echo Password is %password%</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.ukoom.com/documentum-and-soa.htm" title="Documentum and SOA">Documentum and SOA</a></li><li><a href="http://www.ukoom.com/spring%e4%b8%adquartz%e7%9a%84%e8%b0%83%e5%ba%a6%e8%a1%a8%e8%be%be%e5%bc%8f.htm" title="Spring中quartz的调度表达式">Spring中quartz的调度表达式</a></li><li><a href="http://www.ukoom.com/oracle-function-trim.htm" title="Oracle Function Trim">Oracle Function Trim</a></li><li><a href="http://www.ukoom.com/dql-queries-sometime-return-blank-duplicate-rows.htm" title="DQL queries sometime return blank duplicate rows">DQL queries sometime return blank duplicate rows</a></li><li><a href="http://www.ukoom.com/powerdesigner-reverse-engineer.htm" title="PowerDesigner Reverse Engineer">PowerDesigner Reverse Engineer</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/do-not-show-password-in-windows-console.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>No network provider accepted the given network path</title>
		<link>http://www.ukoom.com/no-network-provider-accepted-the-given-network-path.htm</link>
		<comments>http://www.ukoom.com/no-network-provider-accepted-the-given-network-path.htm#comments</comments>
		<pubDate>Mon, 21 Dec 2009 07:17:11 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=981</guid>
		<description><![CDATA[When you try [...]]]></description>
			<content:encoded><![CDATA[<p>When you try to access a network path (FQDN) by “start”-“run”-”\\machine_name\share_name”, and meet error message “No network provider accepted the given network path.” But when you open the Command Console (“start“-“run“-“cmd“), you can ping that machine successfully by using the FQDN.</p>
<p>If you meet this situation, run “sfc /scannow” may be able to solve the problem.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.ukoom.com/how-to-open-vista-windows-sidebar-and-gadgets.htm" title="How to open Vista windows sidebar and gadgets">How to open Vista windows sidebar and gadgets</a></li><li><a href="http://www.ukoom.com/search-bug-of-windows-xp.htm" title="Search bug of Windows XP">Search bug of Windows XP</a></li><li><a href="http://www.ukoom.com/access-is-denied-as-administrator.htm" title="Access is denied as administrator">Access is denied as administrator</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/no-network-provider-accepted-the-given-network-path.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>IF Else in bash of linux</title>
		<link>http://www.ukoom.com/if-else-in-bash-of-linux.htm</link>
		<comments>http://www.ukoom.com/if-else-in-bash-of-linux.htm#comments</comments>
		<pubDate>Fri, 18 Dec 2009 05:31:16 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=973</guid>
		<description><![CDATA[If/Else
In order for [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: small;"><strong>If/Else</strong></span></p>
<p>In order for a script to be very useful, you will need to be able to test the conditions of variables. Most programming and scripting languages have some sort of if/else expression and so does the bourne shell. Unlike most other languages, spaces are very important when using an <strong>if</strong> statement.  Let&#8217;s do a simple script that will ask a user for a password before allowing him to continue.  This is obviously 	not how you would implement such security in a real system, but it will make a good example of using <strong>if</strong> and <strong>else</strong> statements.</p>
<pre>#!/bin/sh
# This is some secure program that uses security.

VALID_PASSWORD="secret" #this is our password.

echo "Please enter the password:"
read PASSWORD

if [ "$PASSWORD" == "$VALID_PASSWORD" ]; then
	echo "You have access!"
else
	echo "ACCESS DENIED!"
fi</pre>
<p>Remember that the spacing is very important in the if statement.  Notice that the termination of the if statement is <strong>fi</strong>.  You will need to use 	the <strong>fi</strong> statement to terminate an if whether or not use use an else as well. You can also replace the &#8220;==&#8221; with &#8220;!=&#8221; to test if the variables are NOT equal. There are other tokens that you can put in place of the &#8220;==&#8221; for other types of tests. The following table shows the different expressions allowed.</p>
<p><strong>Comparisons:</strong></p>
<table border="1">
<tbody>
<tr>
<td><strong>-eq</strong></td>
<td>equal to</td>
</tr>
<tr>
<td><strong>-ne</strong></td>
<td>not equal to</td>
</tr>
<tr>
<td><strong>-lt</strong></td>
<td>less than</td>
</tr>
<tr>
<td><strong>-le</strong></td>
<td>less than or equal to</td>
</tr>
<tr>
<td><strong>-gt</strong></td>
<td>greater than</td>
</tr>
<tr>
<td><strong>-ge</strong></td>
<td>greater than or equal to</td>
</tr>
</tbody>
</table>
<p><strong>File Operations:</strong></p>
<table border="1">
<tbody>
<tr>
<td><strong>-s</strong></td>
<td>file exists and is not empty</td>
</tr>
<tr>
<td><strong>-f</strong></td>
<td>file exists and is not a directory</td>
</tr>
<tr>
<td><strong>-d</strong></td>
<td>directory exists</td>
</tr>
<tr>
<td><strong>-x</strong></td>
<td>file is executable</td>
</tr>
<tr>
<td><strong>-w</strong></td>
<td>file is writable</td>
</tr>
<tr>
<td><strong>-r</strong></td>
<td>file is readable</td>
</tr>
</tbody>
</table>
<p>Let&#8217;s try using a couple of these in a script. This next script will ask for a user name, if there is not a file that exists with the name &#8220;username_DAT&#8221;, the script will prompt the user for their age, it will then make sure that they are old enough to use this program and then it will write their age to a file with the name &#8220;username_DAT&#8221;. If the file already exists, it will just display the age of the user.</p>
<pre>#!/bin/sh

# Prompt for a user name...
echo "Please enter your name:"
read USERNAME

# Check for the file.
if [ -s ${USERNAME}_DAT ]; then
        # Read the age from the file.
        AGE=`cat ${USERNAME}_DAT`
        echo "You are $AGE years old!"
else
        # Ask the user for his/her age
        echo "How old are you?"
        read AGE

	if [ "$AGE" -le 2 ]; then
		echo "You are too young!"
	else
		if [ "$AGE" -ge 100 ]; then
			echo "You are too old!"
		else
        		# Write the age to a new file.
        		echo $AGE &gt; ${USERNAME}_DAT
        	fi
        fi
fi</pre>
<p>Run this program a couple of times. First run it and give it the user name of &#8220;john&#8221;. When it asks for an age, enter the age &#8220;1&#8243;. Notice that it will say that you are too you and then exit. Now run the program again with the name &#8220;john&#8221; and the age 200. This time the script will tell you that you are too old and exit. Now run the the script again with the name of &#8220;john&#8221;, enter the age 30. The script exits normally this time, the program created a file called &#8220;john_DAT&#8221; which contains the text &#8220;30&#8243;. Finally run the program one more time and give it the name &#8220;john&#8221;. This time it will not prompt you to enter an age, instead it will read the age from a file and say &#8220;Your are 30 years old!&#8221;.</p>
<p>We introduced something else new in this script.  On line 10 of the file, we see the code:</p>
<pre>	AGE=`cat ${USERNAME}_DAT`</pre>
<p>This is how you execute a command and put the text output from the command into a variable.  The unix command <strong>cat</strong> reads the file 	named <strong>${USERNAME}_DAT</strong> and outputs it to the console.  Instead of putting it to the console in our script, we wrap the command with 	the character <strong>`</strong>, this puts the text into our variable AGE.</p>
<p>You can test multiple expressions at once by using the <strong>||</strong> (or) operator or the <strong>&amp;&amp;</strong> (and) operator. This can save you from writing extra code to nest if statements. The above code has a nested if statement where it checks if the age is greater than or equal to 100. This could be changed as well by using <strong>elif</strong> (else if).  The structure of <strong>elif</strong> is the same as the structure of <strong>if</strong>, we will use it in an example below. In this example, we will check for certain age ranges. If you are less than 20 or greater than 50, you are out of the age range. If you are between 20 and 30 you are in your 20&#8217;s and so on.</p>
<pre>#!/bin/sh

# Prompt for a user name...
echo "Please enter your age:"
read AGE

if [ "$AGE" -lt 20 ] || [ "$AGE" -ge 50 ]; then
	echo "Sorry, you are out of the age range."
elif [ "$AGE" -ge 20 ] &amp;&amp; [ "$AGE" -lt 30 ]; then
	echo "You are in your 20s"
elif [ "$AGE" -ge 30 ] &amp;&amp; [ "$AGE" -lt 40 ]; then
	echo "You are in your 30s"
elif [ "$AGE" -ge 40 ] &amp;&amp; [ "$AGE" -lt 50 ]; then
	echo "You are in your 40s"
fi</pre>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.ukoom.com/platform-status-libjvm-so-cannot-open-shared-object-file-no-such-file-or-directory.htm" title="Platform Status: libjvm.so: cannot open shared object file: No such file or directory">Platform Status: libjvm.so: cannot open shared object file: No such file or directory</a></li><li><a href="http://www.ukoom.com/chown-change-the-owner-of-a-file.htm" title="chown &#8211; change the owner of a file">chown &#8211; change the owner of a file</a></li><li><a href="http://www.ukoom.com/an-internal-virtual-machine-error-13-has-occurred.htm" title="An internal virtual machine error (13) has occurred">An internal virtual machine error (13) has occurred</a></li><li><a href="http://www.ukoom.com/linux-find-files-containing-text.htm" title="Linux Find Files Containing Text ">Linux Find Files Containing Text </a></li><li><a href="http://www.ukoom.com/copy-and-paste-in-vi.htm" title="Copy and Paste in VI">Copy and Paste in VI</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/if-else-in-bash-of-linux.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Copy and Paste in VI</title>
		<link>http://www.ukoom.com/copy-and-paste-in-vi.htm</link>
		<comments>http://www.ukoom.com/copy-and-paste-in-vi.htm#comments</comments>
		<pubDate>Fri, 18 Dec 2009 05:27:04 +0000</pubDate>
		<dc:creator>ukoom</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://www.ukoom.com/?p=971</guid>
		<description><![CDATA[The command ‘Y’ [...]]]></description>
			<content:encoded><![CDATA[<p>The command ‘Y’ or ‘yy’ copies (yanks) one or more lines. To copy one line, two lines, 10 lines, and all lines to the end of the file, respectively:</p>
<p><code>Y<br />
2Y<br />
10Y<br />
yG</code></p>
<p>To paste the text contained in the buffer above (uppercase P) or below the current cursor position (lowercase p), respectively:</p>
<p><code>P<br />
p</code></p>
<p>It is also possible to yank text within a line. The following commands yank text from the current cursor position to the end of the word and the end of the line, respectively:</p>
<p><code>yw<br />
y$</code></p>
<p>The same commands paste the text within a line.  Lower case p pastes after the cursor position and upper case P pastes before.</p>
<p>Paste will also work with deleted text, either lines or parts of lines. Be careful not to execute any other commands prior to pasting as this will empty the buffer.</p>
<h3  class="related_post_title">Related Posts</h3><ul class="related_post"><li><a href="http://www.ukoom.com/platform-status-libjvm-so-cannot-open-shared-object-file-no-such-file-or-directory.htm" title="Platform Status: libjvm.so: cannot open shared object file: No such file or directory">Platform Status: libjvm.so: cannot open shared object file: No such file or directory</a></li><li><a href="http://www.ukoom.com/chown-change-the-owner-of-a-file.htm" title="chown &#8211; change the owner of a file">chown &#8211; change the owner of a file</a></li><li><a href="http://www.ukoom.com/an-internal-virtual-machine-error-13-has-occurred.htm" title="An internal virtual machine error (13) has occurred">An internal virtual machine error (13) has occurred</a></li><li><a href="http://www.ukoom.com/linux-find-files-containing-text.htm" title="Linux Find Files Containing Text ">Linux Find Files Containing Text </a></li><li><a href="http://www.ukoom.com/if-else-in-bash-of-linux.htm" title="IF Else in bash of linux">IF Else in bash of linux</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.ukoom.com/copy-and-paste-in-vi.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
