SEESenv/web/html/chn11Section_5.html
changeset 25 ed38dd9bdb50
parent 16 2e3d2cadbcb6
child 27 cb14131583c6
--- a/SEESenv/web/html/chn11Section_5.html	Mon Feb 22 22:38:51 2010 +0530
+++ b/SEESenv/web/html/chn11Section_5.html	Tue Feb 23 19:43:04 2010 +0530
@@ -27,7 +27,7 @@
     <dl>
      <dt>
       <span class="article">
-       <a href="#id2894067">
+       <a href="#id2805047">
        </a>
       </span>
      </dt>
@@ -35,58 +35,15 @@
       <dl>
        <dt>
         <span class="section">
-         <a href="#id2704191">
-          1. Introducing Linux
+         <a href="#id2615138">
+          1. Module Objectives:
          </a>
         </span>
        </dt>
-       <dd>
-        <dl>
-         <dt>
-          <span class="section">
-           <a href="#id2891886">
-            1.1. Historical Background
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2945127">
-            1.2. Design and Implications
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2945399">
-            1.3. Reasons for Using Linux
-           </a>
-          </span>
-         </dt>
-        </dl>
-       </dd>
        <dt>
         <span class="section">
-         <a href="#id2945531">
-          2. Getting Started
-         </a>
-        </span>
-       </dt>
-       <dd>
-        <dl>
-         <dt>
-          <span class="section">
-           <a href="#id2945540">
-            2.1. Logging in, activating the user interface and logging out
-           </a>
-          </span>
-         </dt>
-        </dl>
-       </dd>
-       <dt>
-        <span class="section">
-         <a href="#id2945817">
-          3. Basic Commands
+         <a href="#id2803399">
+          2. tar:
          </a>
         </span>
        </dt>
@@ -94,36 +51,22 @@
         <dl>
          <dt>
           <span class="section">
-           <a href="#id2945826">
-            3.1. ls
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2945987">
-            3.2. date
+           <a href="#id2803952">
+            2.1. Introduction:
            </a>
           </span>
          </dt>
          <dt>
           <span class="section">
-           <a href="#id2946047">
-            3.3. cd
+           <a href="#id2856019">
+            2.2. Getting Started(go go go!):
            </a>
           </span>
          </dt>
          <dt>
           <span class="section">
-           <a href="#id2946147">
-            3.4. who
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2946229">
-            3.5. mkdir
+           <a href="#id2856298">
+            2.3. Further Reading for this section:
            </a>
           </span>
          </dt>
@@ -131,8 +74,8 @@
        </dd>
        <dt>
         <span class="section">
-         <a href="#id2946395">
-          4. Getting Help
+         <a href="#id2856343">
+          3. GZip:
          </a>
         </span>
        </dt>
@@ -140,29 +83,15 @@
         <dl>
          <dt>
           <span class="section">
-           <a href="#id2946403">
-            4.1. apropos and whatis
+           <a href="#id2856368">
+            3.1. Get going:
            </a>
           </span>
          </dt>
          <dt>
           <span class="section">
-           <a href="#id2946487">
-            4.2. man
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2946679">
-            4.3. info
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2946765">
-            4.4. --help
+           <a href="#id2856622">
+            3.2. Further Reading for this section:
            </a>
           </span>
          </dt>
@@ -170,47 +99,8 @@
        </dd>
        <dt>
         <span class="section">
-         <a href="#id2946817">
-          5. Basic file handling
-         </a>
-        </span>
-       </dt>
-       <dd>
-        <dl>
-         <dt>
-          <span class="section">
-           <a href="#id2946826">
-            5.1. cp
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2947135">
-            5.2. mv
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2944921">
-            5.3. rm
-           </a>
-          </span>
-         </dt>
-        </dl>
-       </dd>
-       <dt>
-        <span class="section">
-         <a href="#id2947569">
-          6. Command Line Arguments
-         </a>
-        </span>
-       </dt>
-       <dt>
-        <span class="section">
-         <a href="#id2947661">
-          7. Basic Text Processing
+         <a href="#id2856676">
+          4. File Comparisons:
          </a>
         </span>
        </dt>
@@ -218,29 +108,22 @@
         <dl>
          <dt>
           <span class="section">
-           <a href="#id2947670">
-            7.1. head
+           <a href="#id2856693">
+            4.1. cmp:
            </a>
           </span>
          </dt>
          <dt>
           <span class="section">
-           <a href="#id2947756">
-            7.2. tail
+           <a href="#id2856735">
+            4.2. diff:
            </a>
           </span>
          </dt>
          <dt>
           <span class="section">
-           <a href="#id2947883">
-            7.3. cut
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2947969">
-            7.4. paste
+           <a href="#id2856817">
+            4.3. comm:
            </a>
           </span>
          </dt>
@@ -248,72 +131,8 @@
        </dd>
        <dt>
         <span class="section">
-         <a href="#id2948101">
-          8. Shell Meta Characters
-         </a>
-        </span>
-       </dt>
-       <dt>
-        <span class="section">
-         <a href="#id2948205">
-          9. Looking At Files
-         </a>
-        </span>
-       </dt>
-       <dd>
-        <dl>
-         <dt>
-          <span class="section">
-           <a href="#id2948213">
-            9.1. cat
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2948400">
-            9.2. more
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2948510">
-            9.3. less
-           </a>
-          </span>
-         </dt>
-        </dl>
-       </dd>
-       <dt>
-        <span class="section">
-         <a href="#id2948748">
-          10. Directory Structure
-         </a>
-        </span>
-       </dt>
-       <dd>
-        <dl>
-         <dt>
-          <span class="section">
-           <a href="#id2949017">
-            10.1. man hier
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2949033">
-            10.2. ls -l
-           </a>
-          </span>
-         </dt>
-        </dl>
-       </dd>
-       <dt>
-        <span class="section">
-         <a href="#id2949056">
-          11. Permissions and Ownership
+         <a href="#id2856847">
+          5. Environment Variables:
          </a>
         </span>
        </dt>
@@ -321,8 +140,8 @@
         <dl>
          <dt>
           <span class="section">
-           <a href="#id2949065">
-            11.1. chmod
+           <a href="#id2856946">
+            5.1. Further Reading:
            </a>
           </span>
          </dt>
@@ -330,8 +149,8 @@
        </dd>
        <dt>
         <span class="section">
-         <a href="#id2949829">
-          12. Redirection and Piping
+         <a href="#id2857001">
+          6. Shell Scripting:
          </a>
         </span>
        </dt>
@@ -339,91 +158,48 @@
         <dl>
          <dt>
           <span class="section">
-           <a href="#id2949866">
-            12.1. Redirecting standard input and standard output
+           <a href="#id2857009">
+            6.1. Basics:
            </a>
           </span>
          </dt>
          <dt>
           <span class="section">
-           <a href="#id2949936">
-            12.2. Piping
+           <a href="#id2855367">
+            6.2. Shell Arithmetic:
            </a>
           </span>
          </dt>
          <dt>
           <span class="section">
-           <a href="#id2949997">
-            12.3. Redirecting to and from the standard file handles
+           <a href="#id2857386">
+            6.3. if else construct:
            </a>
           </span>
          </dt>
          <dt>
           <span class="section">
-           <a href="#id2950201">
-            12.4. Chained pipelines
+           <a href="#id2857492">
+            6.4. Loops
            </a>
           </span>
          </dt>
          <dt>
           <span class="section">
-           <a href="#id2950235">
-            12.5. Redirect to multiple outputs
+           <a href="#id2857738">
+            6.5. Functions
+           </a>
+          </span>
+         </dt>
+         <dt>
+          <span class="section">
+           <a href="#id2857809">
+            6.6. Further Reading:
            </a>
           </span>
          </dt>
         </dl>
        </dd>
-       <dt>
-        <span class="section">
-         <a href="#id2950266">
-          13. More Text Processing
-         </a>
-        </span>
-       </dt>
-       <dd>
-        <dl>
-         <dt>
-          <span class="section">
-           <a href="#id2950274">
-            13.1. grep
-           </a>
-          </span>
-         </dt>
-         <dt>
-          <span class="section">
-           <a href="#id2950463">
-            13.2. tr
-           </a>
-          </span>
-         </dt>
-        </dl>
-       </dd>
-       <dt>
-        <span class="section">
-         <a href="#id2950613">
-          14. Elementary Regex
-         </a>
-        </span>
-       </dt>
-       <dd>
-        <dl>
-         <dt>
-          <span class="section">
-           <a href="#id2950823">
-            14.1. Lazy quantification
-           </a>
-          </span>
-         </dt>
-        </dl>
-       </dd>
-       <dt>
-        <span class="section">
-         <a href="#id2950898">
-          15. One Liners
-         </a>
-        </span>
-       </dt>
       </dl>
      </dd>
     </dl>
@@ -432,7 +208,11 @@
     <div class="titlepage">
      <div>
       <div>
-       <h2 class="title" id="id2894067">
+       <h2 class="title" id="id2805047">
+       </h2>
+      </div>
+      <div>
+       <h2 class="title" id="id2805047">
        </h2>
       </div>
      </div>
@@ -447,58 +227,15 @@
      <dl>
       <dt>
        <span class="section">
-        <a href="#id2704191">
-         1. Introducing Linux
+        <a href="#id2615138">
+         1. Module Objectives:
         </a>
        </span>
       </dt>
-      <dd>
-       <dl>
-        <dt>
-         <span class="section">
-          <a href="#id2891886">
-           1.1. Historical Background
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2945127">
-           1.2. Design and Implications
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2945399">
-           1.3. Reasons for Using Linux
-          </a>
-         </span>
-        </dt>
-       </dl>
-      </dd>
       <dt>
        <span class="section">
-        <a href="#id2945531">
-         2. Getting Started
-        </a>
-       </span>
-      </dt>
-      <dd>
-       <dl>
-        <dt>
-         <span class="section">
-          <a href="#id2945540">
-           2.1. Logging in, activating the user interface and logging out
-          </a>
-         </span>
-        </dt>
-       </dl>
-      </dd>
-      <dt>
-       <span class="section">
-        <a href="#id2945817">
-         3. Basic Commands
+        <a href="#id2803399">
+         2. tar:
         </a>
        </span>
       </dt>
@@ -506,36 +243,22 @@
        <dl>
         <dt>
          <span class="section">
-          <a href="#id2945826">
-           3.1. ls
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2945987">
-           3.2. date
+          <a href="#id2803952">
+           2.1. Introduction:
           </a>
          </span>
         </dt>
         <dt>
          <span class="section">
-          <a href="#id2946047">
-           3.3. cd
+          <a href="#id2856019">
+           2.2. Getting Started(go go go!):
           </a>
          </span>
         </dt>
         <dt>
          <span class="section">
-          <a href="#id2946147">
-           3.4. who
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2946229">
-           3.5. mkdir
+          <a href="#id2856298">
+           2.3. Further Reading for this section:
           </a>
          </span>
         </dt>
@@ -543,47 +266,8 @@
       </dd>
       <dt>
        <span class="section">
-        <a href="#id2946395">
-         4. Getting Help
-        </a>
-       </span>
-      </dt>
-      <dd>
-       <dl>
-        <dt>
-         <span class="section">
-          <a href="#id2946403">
-           4.1. apropos and whatis
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2946487">
-           4.2. man
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2946679">
-           4.3. info
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2946765">
-           4.4. --help
-          </a>
-         </span>
-        </dt>
-       </dl>
-      </dd>
-      <dt>
-       <span class="section">
-        <a href="#id2946817">
-         5. Basic file handling
+        <a href="#id2856343">
+         3. GZip:
         </a>
        </span>
       </dt>
@@ -591,68 +275,15 @@
        <dl>
         <dt>
          <span class="section">
-          <a href="#id2946826">
-           5.1. cp
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2947135">
-           5.2. mv
+          <a href="#id2856368">
+           3.1. Get going:
           </a>
          </span>
         </dt>
         <dt>
          <span class="section">
-          <a href="#id2944921">
-           5.3. rm
-          </a>
-         </span>
-        </dt>
-       </dl>
-      </dd>
-      <dt>
-       <span class="section">
-        <a href="#id2947569">
-         6. Command Line Arguments
-        </a>
-       </span>
-      </dt>
-      <dt>
-       <span class="section">
-        <a href="#id2947661">
-         7. Basic Text Processing
-        </a>
-       </span>
-      </dt>
-      <dd>
-       <dl>
-        <dt>
-         <span class="section">
-          <a href="#id2947670">
-           7.1. head
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2947756">
-           7.2. tail
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2947883">
-           7.3. cut
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2947969">
-           7.4. paste
+          <a href="#id2856622">
+           3.2. Further Reading for this section:
           </a>
          </span>
         </dt>
@@ -660,15 +291,8 @@
       </dd>
       <dt>
        <span class="section">
-        <a href="#id2948101">
-         8. Shell Meta Characters
-        </a>
-       </span>
-      </dt>
-      <dt>
-       <span class="section">
-        <a href="#id2948205">
-         9. Looking At Files
+        <a href="#id2856676">
+         4. File Comparisons:
         </a>
        </span>
       </dt>
@@ -676,22 +300,22 @@
        <dl>
         <dt>
          <span class="section">
-          <a href="#id2948213">
-           9.1. cat
+          <a href="#id2856693">
+           4.1. cmp:
           </a>
          </span>
         </dt>
         <dt>
          <span class="section">
-          <a href="#id2948400">
-           9.2. more
+          <a href="#id2856735">
+           4.2. diff:
           </a>
          </span>
         </dt>
         <dt>
          <span class="section">
-          <a href="#id2948510">
-           9.3. less
+          <a href="#id2856817">
+           4.3. comm:
           </a>
          </span>
         </dt>
@@ -699,8 +323,8 @@
       </dd>
       <dt>
        <span class="section">
-        <a href="#id2948748">
-         10. Directory Structure
+        <a href="#id2856847">
+         5. Environment Variables:
         </a>
        </span>
       </dt>
@@ -708,33 +332,8 @@
        <dl>
         <dt>
          <span class="section">
-          <a href="#id2949017">
-           10.1. man hier
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2949033">
-           10.2. ls -l
-          </a>
-         </span>
-        </dt>
-       </dl>
-      </dd>
-      <dt>
-       <span class="section">
-        <a href="#id2949056">
-         11. Permissions and Ownership
-        </a>
-       </span>
-      </dt>
-      <dd>
-       <dl>
-        <dt>
-         <span class="section">
-          <a href="#id2949065">
-           11.1. chmod
+          <a href="#id2856946">
+           5.1. Further Reading:
           </a>
          </span>
         </dt>
@@ -742,79 +341,8 @@
       </dd>
       <dt>
        <span class="section">
-        <a href="#id2949829">
-         12. Redirection and Piping
-        </a>
-       </span>
-      </dt>
-      <dd>
-       <dl>
-        <dt>
-         <span class="section">
-          <a href="#id2949866">
-           12.1. Redirecting standard input and standard output
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2949936">
-           12.2. Piping
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2949997">
-           12.3. Redirecting to and from the standard file handles
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2950201">
-           12.4. Chained pipelines
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2950235">
-           12.5. Redirect to multiple outputs
-          </a>
-         </span>
-        </dt>
-       </dl>
-      </dd>
-      <dt>
-       <span class="section">
-        <a href="#id2950266">
-         13. More Text Processing
-        </a>
-       </span>
-      </dt>
-      <dd>
-       <dl>
-        <dt>
-         <span class="section">
-          <a href="#id2950274">
-           13.1. grep
-          </a>
-         </span>
-        </dt>
-        <dt>
-         <span class="section">
-          <a href="#id2950463">
-           13.2. tr
-          </a>
-         </span>
-        </dt>
-       </dl>
-      </dd>
-      <dt>
-       <span class="section">
-        <a href="#id2950613">
-         14. Elementary Regex
+        <a href="#id2857001">
+         6. Shell Scripting:
         </a>
        </span>
       </dt>
@@ -822,230 +350,747 @@
        <dl>
         <dt>
          <span class="section">
-          <a href="#id2950823">
-           14.1. Lazy quantification
+          <a href="#id2857009">
+           6.1. Basics:
+          </a>
+         </span>
+        </dt>
+        <dt>
+         <span class="section">
+          <a href="#id2855367">
+           6.2. Shell Arithmetic:
+          </a>
+         </span>
+        </dt>
+        <dt>
+         <span class="section">
+          <a href="#id2857386">
+           6.3. if else construct:
+          </a>
+         </span>
+        </dt>
+        <dt>
+         <span class="section">
+          <a href="#id2857492">
+           6.4. Loops
+          </a>
+         </span>
+        </dt>
+        <dt>
+         <span class="section">
+          <a href="#id2857738">
+           6.5. Functions
+          </a>
+         </span>
+        </dt>
+        <dt>
+         <span class="section">
+          <a href="#id2857809">
+           6.6. Further Reading:
           </a>
          </span>
         </dt>
        </dl>
       </dd>
-      <dt>
-       <span class="section">
-        <a href="#id2950898">
-         15. One Liners
-        </a>
-       </span>
-      </dt>
      </dl>
     </div>
-    <div class="section" title="1.Introducing Linux">
+    <div class="section" title="1.Module Objectives:">
      <div class="titlepage">
       <div>
        <div>
         <h2 class="title" style="clear: both">
-         <a name="id2704191">
+         <a name="id2615138">
          </a>
-         1.Introducing Linux
+         1.Module Objectives:
         </h2>
        </div>
       </div>
      </div>
      <p id="ch11Section_5_1">
-      (Attribution : A significant chunk of the content under this section is based on data from Wikipedia and the Linux Documentation Project)
-     </p>
-     <p id="ch11Section_5_2">
-      Linux (usually pronounced lnks') is a generic term referring to Unix-like computer operating systems based on the Linux kernel, where a kernel is the intermediate layer between the hardware and the applications. The kernel is, on an abstract level, the core of (most) operating systems, that manages the various system resources. The development of the Linux OS is considered the basis for Free and Open Source Software (FOSS) collaboration since typically the underlying source code can be used, modified freely, and redistributed by anyone under the terms of the GNU (a recursive acronym for "GNU's Not Unix!") Global Public License (GPL) and other free software licences. This freedom to access and reuse various components of a system, is one of the primary reasons for the popularity of Linux.
+      After successfully completing this module a participant will be able to:
      </p>
-     <p id="ch11Section_5_3">
-      Linux is installed on a variety of computer hardware, that include mobile phones, embedded devices and supercomputers, but is infamous for its use in servers.
-     </p>
-     <p id="ch11Section_5_4">
-      The name "Linux"  comes from the Linux kernel, originally written in 1991 by Linus Torvalds. The rest of the system usually comprises components such as the Apache HTTP Server, the X Window System, the GNOME and KDE desktop environments, and utilities and libraries from the GNU Project (announced in 1983 by Richard Stallman). Commonly-used applications with desktop Linux systems include the Mozilla Firefox web-browser and the OpenOffice.org office application suite. The GNU contribution is the basis for the Free Software Foundation's preferred name GNU/Linux. The kernel's mascot is a penguin named "Tux". Mozilla Firefox and OpenOffice.org are open-source projects which can be run on most Operating Systems, including proprietary ones.
-     </p>
-     <div class="section" title="1.1.Historical Background">
+     <pre class="programlisting">
+      - Understand
+  * What are archives and zipped files                              U
+  * What are environment variables                                  U
+  * What are Shell Scripts                                          U
+- Able to use file comparison commands like                         Ap
+  diff, cmp, comm
+- Create and extract archives(.tar files) and zipped files(.gz)     Ap
+- Set/Modify environment as per need                                Ap
+- Create shell scripts to automate tasks.                           Ap
+     </pre>
+    </div>
+    <div class="section" title="2.tar:">
+     <div class="titlepage">
+      <div>
+       <div>
+        <h2 class="title" style="clear: both">
+         <a name="id2803399">
+         </a>
+         2.tar:
+        </h2>
+       </div>
+      </div>
+     </div>
+     <div class="section" title="2.1.Introduction:">
       <div class="titlepage">
        <div>
         <div>
          <h3 class="title">
-          <a name="id2891886">
+          <a name="id2803952">
           </a>
-          1.1.Historical Background
+          2.1.Introduction:
          </h3>
         </div>
        </div>
       </div>
-      <div class="section" title="1.1.1.Events leading to the creation">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2891852">
-           </a>
-           1.1.1.Events leading to the creation
-          </h4>
-         </div>
-        </div>
-       </div>
-       <div class="itemizedlist">
-        <ul class="itemizedlist" type="*">
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_5">
-           The Unix operating system was developed in the 1960s and released for public use in 1970. Its accessibility and portability caused it to be widely adopted, copied and modified by academic institutions and businesses. Its design became influential to authors of other systems. Other free operating systems include the Berkeley Software Distribution (BSD), developed at the University of California at Berkeley, and MINIX which was released by Andrew S. Tanenbaum. The development and adoption of BSD and MINIX were limited due to various reasons, and this lack of a widely-adopted and free kernel triggered Linus Torvalds into starting his project.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_6">
-           In 1983, Richard Stallman started the GNU project with the goal of creating a free UNIX-like operating system. As part of this work, he wrote the GNU General Public License (GPL). By the early 1990s there was almost enough available software to create a full operating system. However, the GNU kernel, called Hurd, failed to attract enough attention from developers leaving GNU incomplete.
-          </p>
-         </li>
-        </ul>
-       </div>
-      </div>
-      <div class="section" title="1.1.2.The Creation of Linux">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2945082">
-           </a>
-           1.1.2.The Creation of Linux
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_7">
-        In 1991, Linus Torvalds began a project at the University of Helsinki that later became the Linux kernel. It was initially a terminal (command-line) emulator, which Torvalds used to access the large UNIX servers of the university. He wrote the program targeting just the hardware he was using and independent of an operating system because he wanted to use the functions of his computer with an 80386 processor. Development was done on Minix using the GNU C compiler. This application is still the main choice for compiling Linux today (although the code can be built with other compilers, such as the Intel C Compiler).
-       </p>
-       <p id="ch11Section_5_8">
-        Torvalds continues to direct the development of the kernel. Stallman heads the Free Software Foundation, which in turn supports the GNU components. Finally, individuals and corporations develop third-party non-GNU components, which constitute a vast body of work and including kernel modules, and user applications and libraries. Linux vendors and communities combine and distribute the kernel, GNU components, and non-GNU components, with additional package management software in the form of Linux distributions.
-       </p>
-      </div>
+      <p id="ch11Section_5_2">
+       In world of Linux based distribution,
+       <span class="emphasis">
+        <em>
+         tarballs
+        </em>
+       </span>
+       is the term which pops up very often. It is part of the GNU project and comes as part of every distribution of GNU/Linux. Tarball is like defacto standard for releasing source code for free software. Some of common use of
+       <span class="emphasis">
+        <em>
+         tar
+        </em>
+       </span>
+       archives is to:
+       <span class="emphasis">
+        <em>
+         Store, backup, and transport
+        </em>
+       </span>
+       .
+      </p>
+      <p id="ch11Section_5_3">
+       GNU tar creates and manipulates archives which are actually collections of many other files; the program provides users with an organized and systematic method for controlling a large amount of data. It is basically form of creating archive by concatenating one or more files.
+      </p>
      </div>
-     <div class="section" title="1.2.Design and Implications">
+     <div class="section" title="2.2.Getting Started(go go go!):">
       <div class="titlepage">
        <div>
         <div>
          <h3 class="title">
-          <a name="id2945127">
+          <a name="id2856019">
           </a>
-          1.2.Design and Implications
+          2.2.Getting Started(go go go!):
          </h3>
         </div>
        </div>
       </div>
-      <p id="ch11Section_5_9">
-       A Linux-based system is a modular Unix-like operating system, deriving much of its basic design from principles established in Unix earlier. Such a system uses a monolithic kernel, called the Linux kernel, which handles process control, networking, and peripheral and file system access. Device drivers are integrated directly with the kernel. Separate projects that interface with the kernel provide much of the system's higher-level functionality. The GNU userland is an important part of most Linux-based systems, providing the most common implementation of the C library, a popular shell, and many of the common Unix tools which carry out many basic operating system tasks. The graphical user interface (or GUI) used by most Linux systems is based on the "X Window System".
+      <p id="ch11Section_5_4">
+       As mentioned previously and if not,
+       <span class="emphasis">
+        <em>
+         The best way to get started with any command line tool of Linux is to use "man".
+        </em>
+       </span>
+      </p>
+      <pre class="programlisting">
+       $ man tar
+      </pre>
+      <p id="ch11Section_5_5">
+       or try these commands(the output may vary with different installations):
       </p>
-      <div class="section" title="1.2.1.User Interface">
+      <pre class="programlisting">
+       $ tar --version
+tar (GNU tar) 1.20
+Copyright (C) 2008 Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later &lt;http://gnu.org/licenses/gpl.html&gt;
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law.
+
+Written by John Gilmore and Jay Fenlason.
+
+$ tar --help
+Usage: tar [OPTION...] [FILE]...
+GNU `tar' saves many files together into a single tape or disk archive, and can
+restore individual files from the archive.
+Examples:
+tar -cf archive.tar foo bar  # Create archive.tar from files foo and bar.
+tar -tvf archive.tar         # List all files in archive.tar verbosely.
+tar -xf archive.tar          # Extract all files from archive.tar.
+____________
+      </pre>
+      <div class="section" title="2.2.1.Creating a tar archive:">
        <div class="titlepage">
         <div>
          <div>
           <h4 class="title">
-           <a name="id2945151">
+           <a name="id2856073">
            </a>
-           1.2.1.User Interface
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_a">
-        Users can control a Linux-based system through a command line interface (or CLI), a graphical user interface (or GUI), or through controls attached to the associated hardware (this is common for embedded systems). For desktop systems, the default mode is usually the GUI. On desktop machines, "KDE", "GNOME" and "Xfce" are the most popular user interfaces,though a variety of additional user interfaces exist. Most popular user interfaces run on top of the "X Window System" (or X), which enables a graphical application running on one machine to be displayed and controlled from another in a network.
-       </p>
-       <p id="ch11Section_5_b">
-        A Linux system also provides a CLI of some sort through a shell, which is the traditional way of interacting with a Unix system. A Linux distribution specialized for servers may use the CLI as its only interface. A headless system (system run without even a monitor) can be controlled by the command line via a remote-control protocol such as SSH or telnet. The CLI is particularly suited for automation of repetitive or delayed tasks, and provides very simple inter-process communication. A graphical terminal emulator program is often used to access the CLI from a Linux desktop.
-       </p>
-      </div>
-      <div class="section" title="1.2.2.Development">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2945205">
-           </a>
-           1.2.2.Development
+           2.2.1.Creating a tar archive:
           </h4>
          </div>
         </div>
        </div>
-       <p id="ch11Section_5_c">
-        The primary difference between Linux and many other popular contemporary operating systems is that the Linux kernel and other components are free and open source software. Linux is not the only such operating system, although it is by far the most widely used. Some free and open source software licenses are based on the principle of "copyleft", a kind of reciprocity: any work derived from a copyleft piece of software must also be copyleft itself. The most common free software license, the GNU GPL, is a form of copyleft, and is used for the Linux kernel and many of the components from the GNU project.
+       <p id="ch11Section_5_6">
+        We will do some off-the road activity for this exercise. We will use an interesting command
+        <span class="emphasis">
+         <em>
+          fortune
+         </em>
+        </span>
+        for creating our practice files and then performing archives of those files and directories. Content of the files would vary for users, as fortune works like that.
+       </p>
+       <pre class="programlisting">
+        $ mkdir fortune-files
+$ cd fortune-files/
+$ fortune &gt; first.txt
+$ cat first.txt
+Expect the worst, it's the least you can do.
+$ fortune &gt; second.txt
+$ fortune &gt; third.txt
+$ ls
+first.txt  second.txt  third.txt
+       </pre>
+       <p id="ch11Section_5_7">
+        By now we have three txt files, with some random fortune content. To create a tar archive of these files we can use any of following commands according to ones convenience:
        </p>
-       <p id="ch11Section_5_d">
-        Linux based distributions are intended by developers for interoperability with other operating systems and established computing standards. Linux systems adhere to POSIX, SUS, ISO and ANSI standards where possible, although to date only one Linux distribution has been POSIX.1 certified, Linux-FT.Free software projects, although developed in a collaborative fashion, are often produced independently of each other. The fact that the software licenses explicitly permit redistribution, however, provides a basis for larger scale projects that collect the software produced by stand-alone projects and make it available all at once in the form of a Linux distribution.
+       <pre class="programlisting">
+        $ tar --create --verbose --file=allfiles.tar first.txt second.txt third.txt
+first.txt
+second.txt
+third.txt
+$ ls
+allfiles.tar  first.txt  second.txt  third.txt
+       </pre>
+       <p id="ch11Section_5_8">
+        allfiles.tar is our required tar archive of all the rest of files(or archive of files mentioned in command line). Other form of the previous command are:
+       </p>
+       <pre class="programlisting">
+        $ tar -c -v -f allfiles.tar first.txt second.txt third.txt
+       </pre>
+       <p id="ch11Section_5_9">
+        or
+       </p>
+       <pre class="programlisting">
+        $ tar -cvf allfiles.tar first.txt second.txt third.txt
+       </pre>
+       <p id="ch11Section_5_a">
+        The general format for creating a tar archive is:
+       </p>
+       <pre class="programlisting">
+        tar [OPTION...] [FILE]...
+       </pre>
+       <p id="ch11Section_5_b">
+        For our command are using these options:
        </p>
-       <p id="ch11Section_5_e">
-        A Linux distribution, commonly called a "distro", is a project that manages a remote collection of system software and application software packages available for download and installation through a network connection. This allows the user to adapt the operating system to his/her specific needs. Distributions are maintained by individuals, loose-knit teams, volunteer organizations, and commercial entities. A distribution can be installed using a CD that contains distribution-specific software for initial system installation and configuration. A package manager such as Synaptic or YAST allows later package upgrades and installations. A distribution is responsible for the default configuration of the installed Linux kernel, general system security, and more generally integration of the different software packages into a coherent whole.
+       <div class="itemizedlist">
+        <ul class="itemizedlist" type="*">
+         <li class="listitem" style="list-style-type: *">
+          <p id="ch11Section_5_c">
+           -c to Create the archive.
+          </p>
+         </li>
+         <li class="listitem" style="list-style-type: *">
+          <p id="ch11Section_5_d">
+           -v for Verbose mode, to get the names of the files as they are archived.
+          </p>
+         </li>
+         <li class="listitem" style="list-style-type: *">
+          <p id="ch11Section_5_e">
+           -f mentioning the file name of the resulting tar archive.
+          </p>
+         </li>
+        </ul>
+       </div>
+       <p id="ch11Section_5_f">
+        To create archive of folder itself try this:
        </p>
+       <pre class="programlisting">
+        $ tar -cvf fortune.tar fortune/
+       </pre>
+       <p id="ch11Section_5_10">
+        To add files to existing tar archive, option
+        <span class="emphasis">
+         <em>
+          `r`
+         </em>
+        </span>
+        is used:
+       </p>
+       <pre class="programlisting">
+        $ fortune &gt; fourth.txt
+$ tar -r fourth.txt -vf allfiles.tar
+fourth.txt
+       </pre>
+       <p id="ch11Section_5_11">
+        There are other options too available for explicitly mentioning the position of archive, use
+        <span class="emphasis">
+         <em>
+          tar --help
+         </em>
+        </span>
+        for getting all the details.
+       </p>
+       <p id="ch11Section_5_12">
+        Similarly to remove file from archive use
+        <span class="emphasis">
+         <em>
+          --delete
+         </em>
+        </span>
+        option:
+       </p>
+       <pre class="programlisting">
+        $ tar --delete second.txt -f allfiles.tar
+$ tar -tf allfiles.tar
+first.txt
+third.txt
+fourth.txt
+       </pre>
       </div>
-      <div class="section" title="1.2.3.Community">
+      <div class="section" title="2.2.2.Listing the files of archive:">
        <div class="titlepage">
         <div>
          <div>
           <h4 class="title">
-           <a name="id2945262">
+           <a name="id2856213">
            </a>
-           1.2.3.Community
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_f">
-        A distribution is largely driven by its developer and user communities. Some vendors develop and fund their distributions on a volunteer basis. Examples include Debian and the Debian-based, Ubuntu. Others maintain a community version of their commercial distributions, as Red Hat does with Fedora.
-       </p>
-       <p id="ch11Section_5_10">
-        In many cities and regions, local associations known as Linux Users Groups (LUGs) seek to promote their preferred distribution and by extension free software. They hold meetings and provide free demonstrations, training, technical support, and operating system installation to new users. Many Internet communities also provide support to Linux users and developers. Most distributions and free software / open source projects have IRC (Internet Relay Chat) chatrooms or newsgroups. Online forums are another means for support. Linux distributions host mailing lists; commonly there will be a specific topic such as usage or development for a given list. All these can be found simply by running an appropriate search on Google.
-       </p>
-       <p id="ch11Section_5_11">
-        Although Linux distributions are generally available without charge, several large corporations sell, support, and contribute to the development of the components of the system and of free software. These include Dell, IBM, HP, Oracle, Sun Microsystems, Novell, Nokia. A number of corporations, notably Red Hat, have built their entire business around Linux distributions.
-       </p>
-      </div>
-      <div class="section" title="1.2.4.Can I make a profit out of running a business involving Linux?">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2945306">
-           </a>
-           1.2.4.Can I make a profit out of running a business involving Linux?
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_12">
-        The answer is, "Yes!". The free software licenses, on which the various software packages of a distribution built on the Linux kernel are based, explicitly accommodate and encourage commercialization; the relationship between a Linux distribution as a whole and individual vendors may be seen as symbiotic. One common business model of commercial suppliers is charging for support, especially for business users. A number of companies also offer a specialized business version of their distribution, which adds proprietary support packages and tools to administer higher numbers of installations or to simplify administrative tasks. Another business model is to give away the software in order to sell hardware. Examples of corporations that are extensively (and sometimes exclusively) open-source and Linux-powered , with successful revenue generation models involving these, are Google, SUN, Mozilla, etc.
-       </p>
-      </div>
-      <div class="section" title="1.2.5.Programming on Linux">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2945352">
-           </a>
-           1.2.5.Programming on Linux
+           2.2.2.Listing the files of archive:
           </h4>
          </div>
         </div>
        </div>
        <p id="ch11Section_5_13">
-        Most Linux distributions support dozens of programming languages. The most common collection of utilities for building both Linux applications and operating system programs is found within the GNU toolchain, which includes the GNU Compiler Collection (GCC) and the GNU build system. Amongst others, GCC provides compilers for Ada, C, C++, Java, and Fortran. The Linux kernel itself is written to be compiled with GCC. Proprietary compilers for Linux include the Intel C++ Compiler, Sun Studio, and IBM XL C/C++ Compiler.
+        Once files are archived, tar command have the
+        <span class="emphasis">
+         <em>
+          `t`
+         </em>
+        </span>
+        option, for Listing all files in the tar file:
        </p>
+       <pre class="programlisting">
+        $ tar tf allfiles.tar
+first.txt
+second.txt
+third.txt
+       </pre>
        <p id="ch11Section_5_14">
-        Most distributions also include support for PHP, Perl, Ruby, Python and other dynamic languages. Examples of languages that are less common, but still supported, are C# via the Mono project, sponsored by Novell, and Scheme. A number of Java Virtual Machines and development kits run on Linux, including the original Sun Microsystems JVM (HotSpot), and IBM's J2SE RE, as well as many open-source projects like Kaffe.
+        <span class="strong">
+         <strong>
+          //this is not working for me in some cases :(
+         </strong>
+        </span>
        </p>
        <p id="ch11Section_5_15">
-        The two main frameworks for developing graphical applications are those of GNOME and KDE. These projects are based on the GTK+ and Qt widget toolkits, respectively, which can also be used independently of the larger framework. Both support a wide variety of languages. There are a number of Integrated Development Environments (IDEs) available including Anjuta, Code::Blocks, Eclipse, KDevelop, Lazarus, MonoDevelop, NetBeans, and Omnis Studio while the long-established editors Vim and Emacs remain popular.
+        To locate a particular file among the archive mention its name after
+        <span class="emphasis">
+         <em>
+          t
+         </em>
+        </span>
+        option.
+       </p>
+       <pre class="programlisting">
+        $ tar t second.txt allfiles.tar
+second.txt
+       </pre>
+       <p id="ch11Section_5_16">
+        one can also use elementary regex for locating the file, so in previous case even second.* will also return the same result.
        </p>
       </div>
+      <div class="section" title="2.2.3.Extracting files from archive:">
+       <div class="titlepage">
+        <div>
+         <div>
+          <h4 class="title">
+           <a name="id2856263">
+           </a>
+           2.2.3.Extracting files from archive:
+          </h4>
+         </div>
+        </div>
+       </div>
+       <p id="ch11Section_5_17">
+        To extract the content from a archive, use
+        <span class="emphasis">
+         <em>
+          `x`
+         </em>
+        </span>
+        option:
+       </p>
+       <pre class="programlisting">
+        $ mkdir extract
+$ cp allfiles.tar extract/
+$ cd extract
+$ tar -xvf allfiles.tar
+first.txt
+second.txt
+third.txt
+       </pre>
+       <p id="ch11Section_5_18">
+        To extract any particular file from archive, mention the name of file after
+        <span class="emphasis">
+         <em>
+          x
+         </em>
+        </span>
+        option:
+       </p>
+       <pre class="programlisting">
+        $ tar -x second.txt -vf allfiles.tar
+second.txt
+       </pre>
+      </div>
      </div>
-     <div class="section" title="1.3.Reasons for Using Linux">
+     <div class="section" title="2.3.Further Reading for this section:">
+      <div class="titlepage">
+       <div>
+        <div>
+         <h3 class="title">
+          <a name="id2856298">
+          </a>
+          2.3.Further Reading for this section:
+         </h3>
+        </div>
+       </div>
+      </div>
+      <div class="itemizedlist">
+       <ul class="itemizedlist" type="*">
+        <li class="listitem" style="list-style-type: *">
+         <p id="ch11Section_5_19">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://en.wikipedia.org/wiki/Tar_(file_format
+         </div>
+         <p>
+          )
+         </p>
+        </li>
+        <li class="listitem" style="list-style-type: *">
+         <p id="ch11Section_5_1a">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://www.gnu.org/software/tar/manual/tar.html
+         </div>
+        </li>
+        <li class="listitem" style="list-style-type: *">
+         <p id="ch11Section_5_1b">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://linuxreviews.org/beginner/
+         </div>
+        </li>
+       </ul>
+      </div>
+     </div>
+    </div>
+    <div class="section" title="3.GZip:">
+     <div class="titlepage">
+      <div>
+       <div>
+        <h2 class="title" style="clear: both">
+         <a name="id2856343">
+         </a>
+         3.GZip:
+        </h2>
+       </div>
+      </div>
+     </div>
+     <p id="ch11Section_5_1c">
+      Tar creates archives but it does not compress data by itself unless specified explicitly. Hence all the archive we create using tar command, is simply of the size of total size of all individual files. With Linux there is a compression tool known as
+      <span class="emphasis">
+       <em>
+        gzip
+       </em>
+      </span>
+      which is used to reduce the size of files mentioned. Whenever possible, each file is replaced by one with the extension .gz', so unlike `tar this command would
+      <span class="emphasis">
+       <em>
+        replace the existing file
+       </em>
+      </span>
+      .
+     </p>
+     <div class="section" title="3.1.Get going:">
       <div class="titlepage">
        <div>
         <div>
          <h3 class="title">
-          <a name="id2945399">
+          <a name="id2856368">
           </a>
-          1.3.Reasons for Using Linux
+          3.1.Get going:
+         </h3>
+        </div>
+       </div>
+      </div>
+      <p id="ch11Section_5_1d">
+       As usual first commands to check out with gzip are
+       <span class="emphasis">
+        <em>
+         man
+        </em>
+       </span>
+       and
+       <span class="emphasis">
+        <em>
+         help
+        </em>
+       </span>
+       ,
+      </p>
+      <pre class="programlisting">
+       $ man gzip
+$ gzip --help
+      </pre>
+      <p id="ch11Section_5_1e">
+       Creating a zip of a bunch of files is fairly trivial, it can be done simply via:
+      </p>
+      <pre class="programlisting">
+       $ gzip [OPTION]... [FILE]...
+      </pre>
+      <div class="section" title="3.1.1.Creating zip files:">
+       <div class="titlepage">
+        <div>
+         <div>
+          <h4 class="title">
+           <a name="id2856399">
+           </a>
+           3.1.1.Creating zip files:
+          </h4>
+         </div>
+        </div>
+       </div>
+       <p id="ch11Section_5_1f">
+        Continuing from previous set of files and setup, we will like to zip them and hence the command would be:
+       </p>
+       <pre class="programlisting">
+        $ gzip first.txt fourth.txt second.txt third.txt
+$ ls
+allfiles.tar  first.txt.gz  fourth.txt.gz  second.txt.gz  third.txt.gz  zipped.tar.gz
+       </pre>
+       <p id="ch11Section_5_20">
+        Hence, as mentioned above, all original files are replaced by .gz extension. The above task can also be restated and made easy with help of some common regex expression:
+       </p>
+       <pre class="programlisting">
+        $ gzip *.txt
+       </pre>
+       <p id="ch11Section_5_21">
+        Similar to
+        <span class="emphasis">
+         <em>
+          tar
+         </em>
+        </span>
+        command, one can also use
+        <span class="emphasis">
+         <em>
+          `-v`
+         </em>
+        </span>
+        option here to see the output in
+        <span class="emphasis">
+         <em>
+          verbose
+         </em>
+        </span>
+        form. For the previous example, if we enable this option the result would be something like this:
+       </p>
+       <pre class="programlisting">
+        $ gzip -v *.txt
+first.txt:    4.4% -- replaced with first.txt.gz
+fourth.txt:  -7.1% -- replaced with fourth.txt.gz
+second.txt:  -4.8% -- replaced with second.txt.gz
+third.txt:    3.8% -- replaced with third.txt.gz
+       </pre>
+       <p id="ch11Section_5_22">
+        For files of very small sizes and some other cases, one might end up with a zipped file whose size is greater then original file, but compression is always performed(so don't be disheartened in the above case, as files are larger :P). So unlike tar, here all files are zipped separately by default, to make them part of one single chunk one can use some
+        <span class="emphasis">
+         <em>
+          pipes
+         </em>
+        </span>
+        and
+        <span class="emphasis">
+         <em>
+          redirections
+         </em>
+        </span>
+       </p>
+       <pre class="programlisting">
+        $ gzip -c *.txt &gt; all.gz
+       </pre>
+       <p id="ch11Section_5_23">
+        Now in this case, all files would be zipped, concatenated and then the output would be written to a file all.gz leaving back all the original files. In the command above
+        <span class="emphasis">
+         <em>
+          `-c`
+         </em>
+        </span>
+        option states to print the output to standard output(stdout) and following
+        <span class="emphasis">
+         <em>
+          `&gt;`
+         </em>
+        </span>
+        would redirect the output to file all.gz. So when we decompress this file, we will get a single file named 'all' with all the content of each files concatenated one after the another.
+       </p>
+       <p id="ch11Section_5_24">
+        For creating a zip archive of a complete directory, one has to use
+        <span class="emphasis">
+         <em>
+          `-r`
+         </em>
+        </span>
+        options which means recursive, it makes gzip to traverse through all directory tree/structure. By default it will create zip files of each file inside the directory, that is even with the -r flag, gzip still compresses one file at a time :
+       </p>
+       <pre class="programlisting">
+        $ gzip -r fortune-files/
+$ gzip -rv .
+./first.txt:          4.4% -- replaced with ./first.txt.gz
+./second.txt:        -4.8% -- replaced with ./second.txt.gz
+./third.txt:          3.8% -- replaced with ./third.txt.gz
+./allfiles.tar:      96.6% -- replaced with ./allfiles.tar.gz
+./fourth.txt:        -7.1% -- replaced with ./fourth.txt.gz
+       </pre>
+       <p id="ch11Section_5_25">
+        Hence one always sees files like xxxxx.tar.gz, to create a zip of whole directory in a single file, first archive everything inside a folder and then use gzip on that. For zipping the files using tar itself, one has to use the option
+        <span class="emphasis">
+         <em>
+          `g`
+         </em>
+        </span>
+        .
+       </p>
+       <pre class="programlisting">
+        $ tar -cvzf zipped.tar.gz *.txt
+first.txt
+fourth.txt
+second.txt
+third.txt
+       </pre>
+       <p id="ch11Section_5_26">
+        <span class="emphasis">
+         <em>
+          Thats why gzip is designed as a complement to tar, not as a replacement.
+         </em>
+        </span>
+       </p>
+       <p id="ch11Section_5_27">
+        gzip command comes with a option
+        <span class="emphasis">
+         <em>
+          `-l`
+         </em>
+        </span>
+        to view the compressed file contents:
+       </p>
+       <pre class="programlisting">
+        $ gzip -l zipped.tar.gz
+         compressed        uncompressed  ratio uncompressed_name
+            332               10240      97.0% zipped.tar
+       </pre>
+       <p id="ch11Section_5_28">
+        Other feature of gzip is option for mentioning the kind of compression one wants. There is a option of
+        <span class="emphasis">
+         <em>
+          `-n`
+         </em>
+        </span>
+        where
+        <span class="emphasis">
+         <em>
+          n varies from 0 to 9
+         </em>
+        </span>
+        which regulate the speed/quality of compression. With
+        <span class="emphasis">
+         <em>
+          `-1`
+         </em>
+        </span>
+        or
+        <span class="emphasis">
+         <em>
+          `--fast`
+         </em>
+        </span>
+        option it means the fastest compression method (less compression) and
+        <span class="emphasis">
+         <em>
+          `--best`
+         </em>
+        </span>
+        or
+        <span class="emphasis">
+         <em>
+          `-9`
+         </em>
+        </span>
+        indicates the slowest compression method, default compression level is
+        <span class="emphasis">
+         <em>
+          `-6`
+         </em>
+        </span>
+        .
+       </p>
+       <p id="ch11Section_5_29">
+        To decompress a already compressed file there are two options, either use
+        <span class="emphasis">
+         <em>
+          `gunzip`
+         </em>
+        </span>
+        command or use
+        <span class="emphasis">
+         <em>
+          `-d`
+         </em>
+        </span>
+        option with gzip command:
+       </p>
+       <pre class="programlisting">
+        $ gzip -dv *.gz
+all.gz:     -440.4% -- replaced with all
+first.txt.gz:         4.4% -- replaced with first.txt
+fourth.txt.gz:       -7.1% -- replaced with fourth.txt
+second.txt.gz:       -4.8% -- replaced with second.txt
+third.txt.gz:         3.8% -- replaced with third.txt
+zipped.tar.gz:       97.0% -- replaced with zipped.tar
+       </pre>
+       <p id="ch11Section_5_2a">
+        or:
+       </p>
+       <pre class="programlisting">
+        $ gunzip -v *.gz
+       </pre>
+       <p id="ch11Section_5_2b">
+        Both of those commands will give the same result. So here one can notice the content of file "all" which we created earlier, it will have content of all the rest of four files concatenated one after another, but "zipped.tar.gz" is zip of tar of all files, will effectively have zip of archives of all files separately, and hence the usage and importance of
+        <span class="emphasis">
+         <em>
+          tar
+         </em>
+        </span>
+        .
+       </p>
+      </div>
+     </div>
+     <div class="section" title="3.2.Further Reading for this section:">
+      <div class="titlepage">
+       <div>
+        <div>
+         <h3 class="title">
+          <a name="id2856622">
+          </a>
+          3.2.Further Reading for this section:
          </h3>
         </div>
        </div>
@@ -1053,4201 +1098,1055 @@
       <div class="itemizedlist">
        <ul class="itemizedlist" type="*">
         <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_16">
-          Linux is free:
+         <p id="ch11Section_5_2c">
          </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://linuxreviews.org/beginner/
+         </div>
         </li>
-       </ul>
-      </div>
-      <p id="ch11Section_5_17">
-       As in "free beer". Linux can be downloaded in its entirety from the Internet completely for free. No registration fees, no costs per user, free updates, and freely available source code in case you want to change the behavior of your system.
-Most of all, Linux is free as in "free speech":
-The license commonly used is the GNU Public License (GPL). The license says that anybody who may want to do so, has the right to change Linux and eventually to redistribute a changed version, on the one condition that the code is still available after redistribution. In practice, you are free to grab a kernel image and sell the new code, as long as your customers can still have a copy of that code.
-      </p>
-      <div class="itemizedlist">
-       <ul class="itemizedlist" type="*">
+        <li class="listitem" style="list-style-type: *">
+         <p id="ch11Section_5_2d">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://lowfatlinux.com/linux-gzip-gunzip.html
+         </div>
+        </li>
         <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_18">
-          Linux is portable to any hardware platform:
+         <p id="ch11Section_5_2e">
          </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://www.gnu.org/software/gzip/manual/gzip.html
+         </div>
         </li>
-       </ul>
-      </div>
-      <p id="ch11Section_5_19">
-       A vendor, who wants to sell a new type of computer and who does not know what kind of OS his/her new machine will run, can take a Linux kernel and make it work on his/her hardware, because documentation related to this activity is freely available.
-      </p>
-      <div class="itemizedlist">
-       <ul class="itemizedlist" type="*">
         <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_1a">
-          Linux was made to keep on running:
+         <p id="ch11Section_5_2f">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://en.wikipedia.org/wiki/ZIP_(file_format
+         </div>
+         <p>
+          )
          </p>
         </li>
        </ul>
       </div>
-      <p id="ch11Section_5_1b">
-       As with UNIX, a Linux system expects to run without rebooting all the time. That is why a lot of tasks are being executed at night or scheduled automatically for other times, resulting in higher availability during busier periods and a more balanced use of the hardware. This property allows for Linux to be applicable to environments where people do not have the time or the possibility to control their systems constantly.
-      </p>
-      <div class="itemizedlist">
-       <ul class="itemizedlist" type="*">
-        <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_1c">
-          Linux is secure and versatile:
-         </p>
-        </li>
-       </ul>
-      </div>
-      <p id="ch11Section_5_1d">
-       The security model used in Linux is based on the UNIX idea of security, which is known to be robust and of proven quality. But Linux is not only safe from attacks from the Internet: it will adapt equally to other situations, utilizing the same high standards for security.
-      </p>
-      <div class="itemizedlist">
-       <ul class="itemizedlist" type="*">
-        <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_1e">
-          Linux is scalable:
-         </p>
-        </li>
-       </ul>
-      </div>
-      <p id="ch11Section_5_1f">
-       From a Palmtop with 2 MB of memory to a petabyte storage cluster with hundreds of nodes: add or remove the appropriate packages and Linux fits all. One does not need a supercomputer anymore,because you can use Linux to do big things using the building blocks provided with the system. If one wants to do little things, such as making an operating system for an embedded processor or just recycling your old 486, Linux will do that as well.
-      </p>
-      <div class="itemizedlist">
-       <ul class="itemizedlist" type="*">
-        <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_20">
-          The Linux OS and Linux applications have very short debugtimes:
-         </p>
-        </li>
-       </ul>
-      </div>
-      <p id="ch11Section_5_21">
-       Because Linux has been developed and tested by thousands of people, both errors and people to fix them are found very quickly. It often happens that there are only a couple of hours between discovery and fixing of a bug.
-      </p>
      </div>
     </div>
-    <div class="section" title="2.Getting Started">
+    <div class="section" title="4.File Comparisons:">
      <div class="titlepage">
       <div>
        <div>
         <h2 class="title" style="clear: both">
-         <a name="id2945531">
+         <a name="id2856676">
          </a>
-         2.Getting Started
+         4.File Comparisons:
         </h2>
        </div>
       </div>
      </div>
-     <div class="section" title="2.1.Logging in, activating the user interface and logging out">
+     <p id="ch11Section_5_30">
+      Linux based distributions also have some utilities for checking the content of files, comparing them very quickly to other files. These operations can be looking for differences/similarities. Some of the commands which prove handy are:
+     </p>
+     <div class="section" title="4.1.cmp:">
       <div class="titlepage">
        <div>
         <div>
          <h3 class="title">
-          <a name="id2945540">
+          <a name="id2856693">
           </a>
-          2.1.Logging in, activating the user interface and logging out
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_22">
-       In order to work on a Linux system directly, one needs to provide a user name and password. You always need to authenticate to the system. Most PCbased Linux systems have two basic modes for a system to run in: either quick and clean in text console mode,which includes with mouse, multitasking and multiuser features, or in graphical console mode, which looks better but eats more system resources.
-      </p>
-      <div class="section" title="2.1.1.Graphical Mode">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2945570">
-           </a>
-           2.1.1.Graphical Mode
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_23">
-        This is the default nowadays on most desktop computers. You know you will be connecting to the system using graphical mode when you are first asked for your user name, and then to type your password.
-       </p>
-       <p id="ch11Section_5_24">
-        To log in, make sure the mouse pointer is in the login window, provide your user name and password to the system and click
-        <span class="emphasis">
-         <em>
-          OK
-         </em>
-        </span>
-        or press
-        <span class="emphasis">
-         <em>
-          Enter
-         </em>
-        </span>
-        .
-It is generally considered a bad idea to connect (graphically) using the root user name, the system adminstrator's account, since the use of graphics includes running a lot of extra programs, in root's case with a lot of extra permissions. To keep all risks as low as possible, use a normal user account to connect graphically. But there are enough risks to keep this in mind as a general advice, for all use of the root account: only log in as root when extra privileges are required.
-       </p>
-       <p id="ch11Section_5_25">
-        After entering your user name/password combination, it can take a little while before the graphical environment is started, depending on the CPU speed of your computer, on the software you use and on your personal settings.
-       </p>
-       <p id="ch11Section_5_26">
-        To continue, you will need to open a
-        <span class="emphasis">
-         <em>
-          terminal window
-         </em>
-        </span>
-        or
-        <span class="emphasis">
-         <em>
-          xterm
-         </em>
-        </span>
-        for short (X being the name for the underlying software supporting the graphical environment). This program can be found in the
-        <span class="emphasis">
-         <em>
-          Applications&gt;Utilities-&gt;System Tools
-         </em>
-        </span>
-        or
-        <span class="emphasis">
-         <em>
-          Internet menu
-         </em>
-        </span>
-        , depending on what window manager you are using. There might be icons that you can use as a shortcut to get an
-        <span class="emphasis">
-         <em>
-          xterm
-         </em>
-        </span>
-        window as well, and clicking the right mouse button on the desktop background will usually present you with a menu containing a terminal window application.
-       </p>
-       <p id="ch11Section_5_27">
-        While browsing the menus, you will notice that a lot of things can be done without entering commands via the keyboard. For most users, the good old pointnclick method of dealing with the computer will do. But for those who want to enter the "heart" of the system, a tool stronger than a mouse will be required to handle the various tasks. This tool is the shell, and when in graphical mode, we activate our shell by opening a terminal window.
-       </p>
-       <p id="ch11Section_5_28">
-        A terminal window should always show a command prompt when you open one. This terminal shows a standard prompt, which displays the user's login name, and the current working directory, represented by the twiddle (~)
-       </p>
-       <p id="ch11Section_5_29">
-        Another common form for a prompt is this one:
-[
-       </p>
-       <div class="reference">
-        <div class="titlepage">
-         <hr />
-        </div>
-        user@host
-       </div>
-       <p>
-        dir]
-       </p>
-       <p id="ch11Section_5_2a">
-        In the above example,
-        <span class="emphasis">
-         <em>
-          user
-         </em>
-        </span>
-        will be your login name,
-        <span class="emphasis">
-         <em>
-          hosts
-         </em>
-        </span>
-        the name of the machine you are working on, and
-        <span class="emphasis">
-         <em>
-          dir
-         </em>
-        </span>
-        an indication of your current location in the file system. Prompts can display all kinds of information, but they are not part of the commands you are giving to your system. To disconnect from the system in graphical mode, you need to close all terminal windows and other applications. After that, hit the
-        <span class="emphasis">
-         <em>
-          logout
-         </em>
-        </span>
-        icon or find
-        <span class="emphasis">
-         <em>
-          Log Out
-         </em>
-        </span>
-        in the menu. Closing everything is not really necessary, and the system can do this for you, but session management might put all currently open applications back on your screen when you connect again, which takes longer and is not always the desired effect. However, this behavior is configurable.
-       </p>
-       <p id="ch11Section_5_2b">
-        When you see the login screen again, asking to enter user name and password, logout was successful.
-       </p>
-      </div>
-      <div class="section" title="2.1.2.Text Mode">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2945728">
-           </a>
-           2.1.2.Text Mode
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_2c">
-        One is in text mode when the whole screen is black, showing (in most cases white) characters. A text mode login screen typically shows some information about the machine you are working on, the name of the machine and a prompt waiting for you to log in.
-       </p>
-       <p id="ch11Section_5_2d">
-        The login is different from a graphical login, in that you have to hit the
-        <span class="emphasis">
-         <em>
-          Enter
-         </em>
-        </span>
-        key after providing your user name, because there are no buttons on the screen that you can click with the mouse. Then you should type your password, followed by another
-        <span class="emphasis">
-         <em>
-          Enter
-         </em>
-        </span>
-        . You will not see any indication that you are entering something, not even an asterisk, and you won't see the cursor move. But this is normal on Linux and is done for security
-reasons.
-       </p>
-       <p id="ch11Section_5_2e">
-        When the system has accepted you as a valid user, you may get some more information, called the
-        <span class="emphasis">
-         <em>
-          message of the day
-         </em>
-        </span>
-        , which can be anything. Additionally, it is popular on UNIX systems to display a fortune cookie, which contains some general wise or unwise (this is up to you) thoughts. After that, you will be given a shell, indicated with the same prompt that you would get in graphical mode.
-       </p>
-       <p id="ch11Section_5_2f">
-        Also in text mode: log in as root only to do setup and configuration that absolutely requires administrator privileges, such as adding users, installing software packages, and performing network and other system configuration. Once you are finished, immediately leave the special account and resume your work as a nonprivileged user.
-       </p>
-       <p id="ch11Section_5_30">
-        Logging out is done by entering the
-        <span class="emphasis">
-         <em>
-          logout
-         </em>
-        </span>
-        command, followed by Enter. You are successfully disconnected from the system when you see the login screen again.Don't poweroff the computer after logging out. It is not meant to be shut off without application of the proper procedures for halting the system. Powering it off without going through the halting process might cause severe damage!
-       </p>
-      </div>
-     </div>
-    </div>
-    <div class="section" title="3.Basic Commands">
-     <div class="titlepage">
-      <div>
-       <div>
-        <h2 class="title" style="clear: both">
-         <a name="id2945817">
-         </a>
-         3.Basic Commands
-        </h2>
-       </div>
-      </div>
-     </div>
-     <div class="section" title="3.1.ls">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2945826">
-          </a>
-          3.1.ls
+          4.1.cmp:
          </h3>
         </div>
        </div>
       </div>
       <p id="ch11Section_5_31">
-       When invoked without any arguments,
+       If one wants to compare two files whether they are same or not, one can use this handy tool. Let us consider some situation, we run find/locate command to locate some file, and it turns out that we have a file with same name in different location, and in case we want to run a quick check on there content, cmp is the right tool. For my system I perform these tasks to illustrate the use of this command:
+      </p>
+      <pre class="programlisting">
+       $ find . -name quick.c
+./Desktop/programs/quick.c
+./c-folder/quick.c
+$ cmp Desktop/programs/quick.c c-folder/quick.c
+$
+      </pre>
+      <p id="ch11Section_5_32">
+       For me it returns nothing, hence that means both the files are exact copy of each other, by default, cmp is silent if the files are the same. Make some changes in one of the file and rerun the command. For me it works like this:
+      </p>
+      <pre class="programlisting">
+       $ cmp Desktop/programs/quick.c c-folder/quick.c
+Desktop/programs/quick.c c-folder/quick.c differ: byte 339, line 24
+      </pre>
+      <p id="ch11Section_5_33">
+       That is, if files differ, the byte and line number at which the first difference occurred is reported.
+      </p>
+     </div>
+     <div class="section" title="4.2.diff:">
+      <div class="titlepage">
+       <div>
+        <div>
+         <h3 class="title">
+          <a name="id2856735">
+          </a>
+          4.2.diff:
+         </h3>
+        </div>
+       </div>
+      </div>
+      <p id="ch11Section_5_34">
+       Now there are situations when one wants to exactly know the differences among two files, for them, GNU diff can show whether files are different without detailing the differences. For simple and basic usage of this programs, consider following example:
+      </p>
+      <pre class="programlisting">
+       $ echo -e "quick nbrown nfox njumped nover nthe nlazy ndog" &gt; allcharacters.txt
+$ echo -e "quick nbrown nfox njmuped nover nteh nlzay ndog" &gt; problem.txt
+$ diff problem.txt allcharacters.txt
+4c4
+&lt; jmuped
+---
+&gt; jumped
+6,7c6,7
+&lt; teh
+&lt; lzay
+---
+&gt; the
+&gt; lazy
+      </pre>
+      <p id="ch11Section_5_35">
+       Looking at results above mentioned it is very trivial to deduce that, diff if used on two separate text files will result in line by line results for all the lines which are different. So most common use case scenario can be, got some files in various location of system with same name and size, just run diff through them and remove all the redundant files. Other similar command which one can find more effective for this can be
        <span class="emphasis">
         <em>
-         ls
-        </em>
-       </span>
-       lists the files in the current working directory. A directory that is not the current working directory can be specified and ls will list the files there. The user also may specify any list of files and directories. In this case, all files and all contents of specified directories will be listed. The name
-       <span class="emphasis">
-        <em>
-         ls
-        </em>
-       </span>
-       is derived from
-       <span class="emphasis">
-        <em>
-         list segments
+         sdiff
         </em>
        </span>
-       which was used in earlier systems.
+       , for the same files using sdiff will result in:
       </p>
-      <p id="ch11Section_5_32">
-       Files whose names start with "." are not listed, unless the
-       <span class="emphasis">
-        <em>
-         -a
-        </em>
-       </span>
-       flag is specified or the files are specified explicitly.
-      </p>
-      <p id="ch11Section_5_33">
-       Without options,
-       <span class="emphasis">
-        <em>
-         ls
-        </em>
-       </span>
-       displays files in a bare format. This bare format however makes it difficult to establish the type, permissions, and size of the files. The most common options to reveal this information or change the list of files are:
+      <pre class="programlisting">
+       $ sdiff problem.txt allcharacters.txt
+quick                                                               quick
+brown                                                               brown
+fox                                                                 fox
+jmuped                                                            | jumped
+over                                                                over
+teh                                                               | the
+lzay                                                              | lazy
+dog                                                                 dog
+      </pre>
+      <p id="ch11Section_5_36">
+       Some exercise for a change:
       </p>
       <div class="itemizedlist">
        <ul class="itemizedlist" type="*">
         <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_34">
-          <span class="emphasis">
-           <em>
-            -l
-           </em>
-          </span>
-          long format, displaying Unix file types, permissions, number of hard links, owner, group, size, date, and filename
-         </p>
-        </li>
-        <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_35">
-          <span class="emphasis">
-           <em>
-            -F
-           </em>
-          </span>
-          appends a character revealing the nature of a file, for example, * for an executable, or / for a directory. Regular files have no suffix.
-         </p>
-        </li>
-        <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_36">
-          <span class="emphasis">
-           <em>
-            -a
-           </em>
-          </span>
-          lists all files in the given directory, including those whose names start with "." (which are hidden files in Unix). By default, these files are excluded from the list.
-         </p>
-        </li>
-        <li class="listitem" style="list-style-type: *">
          <p id="ch11Section_5_37">
-          <span class="emphasis">
-           <em>
-            -R
-           </em>
-          </span>
-          recursively lists subdirectories. The command ls -R / would therefore list all files.
+          Try using diff for any binary file, does it work?
          </p>
         </li>
         <li class="listitem" style="list-style-type: *">
          <p id="ch11Section_5_38">
-          <span class="emphasis">
-           <em>
-            -d
-           </em>
-          </span>
-          shows information about a symbolic link or directory, rather than about the link's target or listing the contents of a directory.
+          What are other equivalent for diff command based on needs/requirements?
          </p>
         </li>
         <li class="listitem" style="list-style-type: *">
          <p id="ch11Section_5_39">
-          <span class="emphasis">
-           <em>
-            -t
-           </em>
-          </span>
-          sort the list of files by modification time.
-         </p>
-        </li>
-        <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_3a">
-          <span class="emphasis">
-           <em>
-            -h
-           </em>
-          </span>
-          print sizes in human readable format. (e.g., 1K, 234M, 2G, etc.)
+          Can we use diff to compare two directories? If yes how?
          </p>
         </li>
        </ul>
       </div>
-      <p id="ch11Section_5_3b">
-       In some environments, providing the option
-       <span class="emphasis">
-        <em>
-         --color
-        </em>
-       </span>
-       (for GNU ls) or
-       <span class="emphasis">
-        <em>
-         -G
-        </em>
-       </span>
-       (FreeBSD ls) causes ls to highlight different types of files with different colors, instead of with characters as
-       <span class="emphasis">
-        <em>
-         -F
-        </em>
-       </span>
-       would. To determine what color to use for a file, GNU
-       <span class="emphasis">
-        <em>
-         ls
-        </em>
-       </span>
-       checks the Unix file type, the file permissions, and the file extension, while FreeBSD
-       <span class="emphasis">
-        <em>
-         ls
-        </em>
-       </span>
-       checks only the Unix file type and file permissions.:
-      </p>
-      <pre class="programlisting">
-       $ ls
-jeeves.rst psmith.html blandings.html
-$ ls -l
-drwxr--r--   1 plum  editors   4096  jeeves
--rw-r--r--   1 plum  editors  30405  psmith
--r-xr-xr-x   1 plum  plum      8460  blandings
-      </pre>
-      <p id="ch11Section_5_3c">
-       Here "$" actually is the beginning of the prompt. This is typical in most Unix-based systems.
-      </p>
      </div>
-     <div class="section" title="3.2.date">
+     <div class="section" title="4.3.comm:">
       <div class="titlepage">
        <div>
         <div>
          <h3 class="title">
-          <a name="id2945987">
+          <a name="id2856817">
           </a>
-          3.2.date
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_3d">
-       The Unix date command displays the time and date. The super-user can use it to set the system clock.
-      </p>
-      <p id="ch11Section_5_3e">
-       With no options, the date command displays the current date and time, including the abbreviated day name, abbreviated month name, day of the month, the time separated by colons, the timezone name, and the year. For example:
-      </p>
-      <pre class="programlisting">
-       $date
-Tue Sep  8 12:01:45 IST 2009
-      </pre>
-      <p id="ch11Section_5_3f">
-       On some systems to set the current date and time to September 8, 2004 01:22 you type:
-      </p>
-      <pre class="programlisting">
-       $date --set="20040908 01:22"
-      </pre>
-      <p id="ch11Section_5_40">
-       In order to view the various options for the
-       <span class="emphasis">
-        <em>
-         date
-        </em>
-       </span>
-       command, type:
-      </p>
-      <pre class="programlisting">
-       $man date
-      </pre>
-      <p id="ch11Section_5_41">
-       This will take you to the "Manual" page comprising of all the details on the
-       <span class="emphasis">
-        <em>
-         date
-        </em>
-       </span>
-       command. You can return to the terminal from the "man" page by pressing the
-       <span class="emphasis">
-        <em>
-         Esc
-        </em>
-       </span>
-       key in the keyboard and typing ":q" in that order.
-      </p>
-     </div>
-     <div class="section" title="3.3.cd">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2946047">
-          </a>
-          3.3.cd
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_42">
-       This stands for "change directory". When one wants to go up to the parent directory, bypassing the tree of directories one has entered,  cd .. can be used.
-      </p>
-      <p id="ch11Section_5_43">
-       One dot '.' represents the current directory while two dots '..' represent the parent directory.
-      </p>
-      <p id="ch11Section_5_44">
-       cd - will return you to the previous directory (a bit like an undo).
-      </p>
-      <p id="ch11Section_5_45">
-       You can also use cd absolute path or cd relative path (see below):
-      </p>
-      <p id="ch11Section_5_46">
-       Absolute paths:
-      </p>
-      <p id="ch11Section_5_47">
-       An  absolute path is easily recognised from the leading forward slash, /. The / means that you start at the top level directory and continue down.
-      </p>
-      <p id="ch11Section_5_48">
-       For example to get to /boot/grub you would type:
-      </p>
-      <pre class="programlisting">
-       $cd /boot/grub
-      </pre>
-      <p id="ch11Section_5_49">
-       This is an absolute path because you start at the top of the hierarchy and go downwards from there (it doesn't matter where in the filesystem you were when you typed the command).
-      </p>
-      <p id="ch11Section_5_4a">
-       Relative paths:
-      </p>
-      <p id="ch11Section_5_4b">
-       A  relative path doesn't have a preceding slash. Use a relative path when you start from a directory below the top level directory structure. This is dependent on where you are in the filesystem.
-      </p>
-      <p id="ch11Section_5_4c">
-       For example if you are in root's home directory and want to get to /root/music, you type:
-      </p>
-      <pre class="programlisting">
-       $ cd music
-      </pre>
-      <p id="ch11Section_5_4d">
-       Please note that there is no / using the above cd command. Using a / would cause this to be an absolute path, working from the top of the hierarchy downward.
-      </p>
-     </div>
-     <div class="section" title="3.4.who">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2946147">
-          </a>
-          3.4.who
+          4.3.comm:
          </h3>
         </div>
        </div>
       </div>
-      <p id="ch11Section_5_4e">
-       The standard Unix command
-       <span class="emphasis">
-        <em>
-         who
-        </em>
-       </span>
-       displays a list of users who are currently logged into a computer.
-      </p>
-      <p id="ch11Section_5_4f">
-       The
-       <span class="emphasis">
-        <em>
-         who
-        </em>
-       </span>
-       command is related to the command
-       <span class="emphasis">
-        <em>
-         w
-        </em>
-       </span>
-       , which provides the same information but also displays additional data and statistics.:
+      <p id="ch11Section_5_3a">
+       This is one more command which proves handy at times, the short and sweet man page states "compare two sorted files line by line". Or this it compares sorted files and selects or rejects lines common to two files. For ex:
       </p>
       <pre class="programlisting">
-       $who
-beeblebrox tty7         2009-09-08 10:50 (:0)
-beeblebrox pts/0        2009-09-08 11:25 (:0.0)
-dumbledore pts/1        2009-09-08 18:11 (potter.xyz.in)
-beeblebrox pts/2        2009-09-08 18:53 (:0.0)
+       $ sort allcharacters.txt&gt;sortedcharac.txt; sort problem.txt&gt;sortedprob.txt
+$ comm sortedcharac.txt sortedprob.txt
+             brown
+             dog
+             fox
+     jmuped
+jumped
+lazy
+     lzay
+             over
+             quick
+     teh
+the
       </pre>
-      <p id="ch11Section_5_50">
-       The command can be invoked with the arguments
-       <span class="emphasis">
-        <em>
-         am i
-        </em>
-       </span>
-       or
-       <span class="emphasis">
-        <em>
-         am I
-        </em>
-       </span>
-       (so it is invoked as
-       <span class="emphasis">
-        <em>
-         who am i
-        </em>
-       </span>
-       or * who am I*), showing information about the current terminal only (see the
-       <span class="emphasis">
-        <em>
-         -m
-        </em>
-       </span>
-       option below, of which this invocation is equivalent).
-      </p>
-      <p id="ch11Section_5_51">
-       In order to find out the various options that can be appended to the
-       <span class="emphasis">
-        <em>
-         who
-        </em>
-       </span>
-       command, check the
-       <span class="emphasis">
-        <em>
-         man
-        </em>
-       </span>
-       page by typing out the following in the terminal:
-      </p>
-      <pre class="programlisting">
-       $man who
-      </pre>
-      <p id="ch11Section_5_52">
-       This will take you to the "Manual" page containing details about the
-       <span class="emphasis">
-        <em>
-         who
-        </em>
-       </span>
-       command
-      </p>
+     </div>
+    </div>
+    <div class="section" title="5.Environment Variables:">
+     <div class="titlepage">
+      <div>
+       <div>
+        <h2 class="title" style="clear: both">
+         <a name="id2856847">
+         </a>
+         5.Environment Variables:
+        </h2>
+       </div>
+      </div>
      </div>
-     <div class="section" title="3.5.mkdir">
+     <p id="ch11Section_5_3b">
+      These variables like HOME, OSTYPE,Variables are a way of passing information from the shell to programs when you run them. Programs look "in the environment" for particular variables and if they are found will use the values stored. Standard UNIX variables are split into two categories, environment variables and shell variables. In broad terms, shell variables apply only to the current instance of the shell and are used to set short-term working conditions; environment variables have a farther reaching significance, and those set at login are valid for the duration of the session.By convention, environment variables have UPPER CASE and shell variables have lower case names.
+     </p>
+     <p id="ch11Section_5_3c">
+      Some of examples of Environment variables are(result may vary!):
+     </p>
+     <pre class="programlisting">
+      $ echo $OSTYPE
+linux-gnu
+$ echo $HOME
+/home/baali
+     </pre>
+     <p id="ch11Section_5_3d">
+      To see all the variables and there values use any of following commands:
+     </p>
+     <pre class="programlisting">
+      $ printenv | less
+$ env
+     </pre>
+     <p id="ch11Section_5_3e">
+      The most commonly used environment variable is "PATH", it defines a list of directories to search through when looking for a command to execute. If you decide to put your own programs in a bin directory under your home directory, you'll have to modify the path to include that directory, or the system will never find your programs (unless you happen to be in that directory when you enter the command). Here's how to change your PATH variable so it includes your personal bin directory:
+     </p>
+     <pre class="programlisting">
+      $ set PATH=$PATH:$HOME/bin
+     </pre>
+     <p id="ch11Section_5_3f">
+      See the difference in value of PATH variable before and after modifying it. One can also create its own variable to make things easier:
+     </p>
+     <pre class="programlisting">
+      $ set repo = $HOME/Desktop/random/code
+$ cd $repo
+     </pre>
+     <p id="ch11Section_5_40">
+      <span class="emphasis">
+       <em>
+        set
+       </em>
+      </span>
+      command is used to define a variable for the current shell. Try opening a new shell and use the above mentioned command, it wont work as expected. The other child process wont be able to see these variables unless we
+      <span class="emphasis">
+       <em>
+        export
+       </em>
+      </span>
+      them. Repeat the above mentioned activity with
+      <span class="emphasis">
+       <em>
+        export
+       </em>
+      </span>
+      command. Now with all new shells,
+      <span class="emphasis">
+       <em>
+        $repo
+       </em>
+      </span>
+      will work.
+     </p>
+     <p id="ch11Section_5_41">
+      Again these changes are limited to current session. To make them permanent or get loaded each time you log in, just add those lines to
+      <span class="emphasis">
+       <em>
+        .bashrc
+       </em>
+      </span>
+      file.
+     </p>
+     <div class="section" title="5.1.Further Reading:">
       <div class="titlepage">
        <div>
         <div>
          <h3 class="title">
-          <a name="id2946229">
+          <a name="id2856946">
           </a>
-          3.5.mkdir
+          5.1.Further Reading:
          </h3>
         </div>
        </div>
       </div>
-      <p id="ch11Section_5_53">
-       This command is used to make a new directory. Normal usage is as straightforward as follows:
-      </p>
-      <pre class="programlisting">
-       $mkdir name_of_directory
-      </pre>
-      <p id="ch11Section_5_54">
-       Where
-       <span class="emphasis">
-        <em>
-         name_of_directory
-        </em>
-       </span>
-       is the name of the directory one wants to create. When typed as above (ie. normal usage), the new directory would be created within the current directory. On Unix, multiple directories can be specified, and
-       <span class="emphasis">
-        <em>
-         mkdir
-        </em>
-       </span>
-       will try to create all of them.
-      </p>
-      <div class="section" title="3.5.1.Options">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2946261">
-           </a>
-           3.5.1.Options
-          </h4>
+      <div class="itemizedlist">
+       <ul class="itemizedlist" type="*">
+        <li class="listitem" style="list-style-type: *">
+         <p id="ch11Section_5_42">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://lowfatlinux.com/linux-environment-variables.html
+         </div>
+        </li>
+        <li class="listitem" style="list-style-type: *">
+         <p id="ch11Section_5_43">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://www.codecoffee.com/tipsforlinux/articles/030.html
          </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_55">
-        On Unix-like operating systems,
-        <span class="emphasis">
-         <em>
-          mkdir
-         </em>
-        </span>
-        takes options. Three of the most common options are:
-       </p>
-       <div class="itemizedlist">
-        <ul class="itemizedlist" type="*">
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_56">
-           <span class="emphasis">
-            <em>
-             -p
-            </em>
-           </span>
-           : will also create all directories leading up to the given directory that do not exist already. If the given directory already exists, ignore the error.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_57">
-           <span class="emphasis">
-            <em>
-             -v
-            </em>
-           </span>
-           : display each directory that mkdir creates. Most often used with -p.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_58">
-           <span class="emphasis">
-            <em>
-             -m
-            </em>
-           </span>
-           : specify the octal permissions of directories created by mkdir.
-          </p>
-         </li>
-        </ul>
-       </div>
-       <p id="ch11Section_5_59">
-        <span class="emphasis">
-         <em>
-          -p
-         </em>
-        </span>
-        is most often used when using mkdir to build up complex directory hierarchies, in case a necessary directory is missing or already there. -m is commonly used to lock down temporary directories used by shell scripts.
-       </p>
-      </div>
-      <div class="section" title="3.5.2.Examples">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2946319">
-           </a>
-           3.5.2.Examples
-          </h4>
+        </li>
+        <li class="listitem" style="list-style-type: *">
+         <p id="ch11Section_5_44">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://www.ee.surrey.ac.uk/Teaching/Unix/unix8.html
          </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_5a">
-        An example of
-        <span class="emphasis">
-         <em>
-          -p
-         </em>
-        </span>
-        in action is:
-       </p>
-       <pre class="programlisting">
-        $mkdir -p /tmp/a/b/c
-       </pre>
-       <p id="ch11Section_5_5b">
-        If
-        <span class="emphasis">
-         <em>
-          /tmp/a
-         </em>
-        </span>
-        exists but
-        <span class="emphasis">
-         <em>
-          /tmp/a/b
-         </em>
-        </span>
-        does not, mkdir will create
-        <span class="emphasis">
-         <em>
-          /tmp/a/b
-         </em>
-        </span>
-        before creating
-        <span class="emphasis">
-         <em>
-          /tmp/a/b/c
-         </em>
-        </span>
-        .
-       </p>
-       <p id="ch11Section_5_5c">
-        And an even more powerful command, creating a full tree at once (this however is a Shell extension, nothing mkdir does itself):
-       </p>
-       <pre class="programlisting">
-        $mkdir -p tmpdir/{trunk/sources/{includes,docs},branches,tags}
-       </pre>
-       <p id="ch11Section_5_5d">
-        This will create:
-       </p>
-       tmpdir  - branches
-       <div class="itemizedlist">
-        <ul class="itemizedlist" type="*">
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_5e">
-           tag
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          trunk - sources - includes
-          <div class="itemizedlist">
-           <ul class="itemizedlist" type="*">
-            <li class="listitem" style="list-style-type: *">
-             <p id="ch11Section_5_5f">
-              docs
-             </p>
-            </li>
-           </ul>
+        </li>
+        <li class="listitem" style="list-style-type: *">
+         <p id="ch11Section_5_45">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
           </div>
-         </li>
-        </ul>
-       </div>
+          http://en.wikipedia.org/wiki/Environment_variable
+         </div>
+        </li>
+       </ul>
       </div>
      </div>
     </div>
-    <div class="section" title="4.Getting Help">
+    <div class="section" title="6.Shell Scripting:">
      <div class="titlepage">
       <div>
        <div>
         <h2 class="title" style="clear: both">
-         <a name="id2946395">
+         <a name="id2857001">
          </a>
-         4.Getting Help
+         6.Shell Scripting:
         </h2>
        </div>
       </div>
      </div>
-     <div class="section" title="4.1.apropos and whatis">
+     <div class="section" title="6.1.Basics:">
       <div class="titlepage">
        <div>
         <div>
          <h3 class="title">
-          <a name="id2946403">
+          <a name="id2857009">
           </a>
-          4.1.apropos and whatis
+          6.1.Basics:
          </h3>
         </div>
        </div>
       </div>
-      <p id="ch11Section_5_60">
-       This is a command to search the manual pages files in Unix and Unix-like operating systems.
-      </p>
-      <pre class="programlisting">
-       $ apropos grep
-egrep       egrep (1)       Search a file for a pattern using full regular expressions
-fgrep       fgrep (1)       Search a file for a fixed-character string
-fmlgrep     fmlgrep (1)     Search a file for a pattern
-grep        grep (1)        Search a file for a pattern
-gzgrep      gzgrep (1)      Search a possibly compressed file for a regular expression
-nisgrep     nismatch (1)    Utilities for searching NIS+ tables
-pgrep       pgrep (1)       Find or signal a process by name or other attribute
-zgrep       zgrep (1)       Search a possibly compressed file for a regular expression
-...
-      </pre>
-      <p id="ch11Section_5_61">
-       In this example, the user uses
-       <span class="emphasis">
-        <em>
-         apropos
-        </em>
-       </span>
-       to search for the string "grep", and apropos returns the indicated
+      <p id="ch11Section_5_46">
+       Shell program or shell script,a sequence of commands to a text file and tell the shell to execute the text file instead of entering the commands. The first
        <span class="emphasis">
         <em>
-         man
-        </em>
-       </span>
-       pages that include the term "grep".
-      </p>
-      <p id="ch11Section_5_62">
-       A short index of explanations for commands is available using the
-       <span class="emphasis">
-        <em>
-         whatis
+         "Hello World"
         </em>
        </span>
-       command, like in the examples below:
-      </p>
-      <pre class="programlisting">
-       $whatis ls
-ls (1)           - list directory contents
-      </pre>
-      <p id="ch11Section_5_63">
-       This displays short information about a command, and the first section in the collection of man pages that contains an appropriate page.
-      </p>
-      <p id="ch11Section_5_64">
-       If you don't know where to get started and which man page to read,
-       <span class="emphasis">
-        <em>
-         apropos
-        </em>
-       </span>
-       gives more information. Say that you do not know how to start a browser, then you could enter the following command:
+       sample for shell scripting is as easy as it sounds:
       </p>
       <pre class="programlisting">
-       $apropos browser
-gmusicbrowser (1)    - Jukebox for large collections of audio files
-infobrowser (1)      - read Info documents
-libsmbclient (7)     - An extension library for browsers and that               can be used...
-opera (1)            - a standards-compliant graphical Web browser
-sensible-browser (1) - sensible editing, paging, and web browsing
-smbtree (1)          - A text based smb network browser
-tvtk_doc (1)         - A GUI based TVTK documentation search browser.
-viewres (1)          - graphical class browser for Xt
-w3m (1)              - a text based Web browser and pager
-www-browser (1)      - a text based Web browser and pager
-...
+       $ echo '#!/bin/sh' &gt; my-script.sh
+$ clear &gt;&gt; my-script.sh
+$ echo 'echo Hello World' &gt;&gt; my-script.sh
+$ chmod 755 my-script.sh
+$ ./my-script.sh
+Hello World
       </pre>
-     </div>
-     <div class="section" title="4.2.man">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2946487">
-          </a>
-          4.2.man
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_65">
-       Man pages (short for "manual pages") are the extensive documentation that comes preinstalled with almost all substantial Unix and Unix-like operating systems. The Unix command used to display them is
+      <p id="ch11Section_5_47">
+       The #! syntax(also known as shebang) is used in scripts to indicate an interpreter for execution under UNIX / Linux operating systems. The chmod is required to make the script executable. This script will just execute two commands,
        <span class="emphasis">
         <em>
-         man
-        </em>
-       </span>
-       . Each page is a self-contained document.
-      </p>
-      <p id="ch11Section_5_66">
-       To read a manual page for a Unix command, one can use:
-      </p>
-      <pre class="programlisting">
-       $ man &lt;command_name&gt;
-      </pre>
-      <p id="ch11Section_5_67">
-       at a shell prompt; for example, "man ftp". In order to simplify navigation through the output,
-       <span class="emphasis">
-        <em>
-         man
-        </em>
-       </span>
-       generally uses the less terminal pager.
-      </p>
-      <p id="ch11Section_5_68">
-       Pages are traditionally referred to using the notation "name(section)"; for example, ftp(1). The same page name may appear in more than one section of the manual, this can occur when the names of system calls, user commands, or macro packages coincide. Two examples are
-       <span class="emphasis">
-        <em>
-         man(1)
-        </em>
-       </span>
-       and
-       <span class="emphasis">
-        <em>
-         man(7)
-        </em>
-       </span>
-       , or
-       <span class="emphasis">
-        <em>
-         exit(2)
+         clear
         </em>
        </span>
        and
        <span class="emphasis">
         <em>
-         exit(3)
+         echo
         </em>
        </span>
-       . The syntax for accessing the non-default manual section varies between different man implementations. On Linux and
+       one after another. One can also do the same task using a one liner command
        <span class="emphasis">
         <em>
-         BSD, for example, the syntax for reading *printf(3)
+         clear; echo 'Hello World';
         </em>
        </span>
-       is:
+       but as number of lines grows using a script file is helpful.
       </p>
-      <pre class="programlisting">
-       $man 3 printf
-      </pre>
-      <p id="ch11Section_5_69">
-       Another example:
+      <p id="ch11Section_5_48">
+       So lets create a script which gives us all the filenames for given initial alphabet or string in a directory. Let the name of script be
+       <span class="emphasis">
+        <em>
+         initial.sh
+        </em>
+       </span>
+       , open it with text editor, and write:
       </p>
       <pre class="programlisting">
-       $man man
+       #!/bin/sh
+ls &gt; temp
+grep ^$1 &lt; temp
+rm temp
+$ chmod a+x initial.sh
+$ ./initial.sh s
       </pre>
-      <p id="ch11Section_5_6a">
-       The previous example will take you to the "Manual" page entry about manual pages!
+      <p id="ch11Section_5_49">
+       The $1 in the script is pertaining to command line argument. All arguments passed via command line are accessed via
+       <span class="emphasis">
+        <em>
+         $#
+        </em>
+       </span>
+       with name of script being first member, that is $0. Now lets write a script for finding a file, and then checking when was it last modified:
       </p>
-      <div class="section" title="4.2.1.Layout">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2946569">
-           </a>
-           4.2.1.Layout
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_6b">
-        All man pages follow a common layout that is optimized for presentation on a simple ASCII text display, possibly without any form of highlighting or font control. Sections present may include:
-       </p>
-       NAME
-       <p id="ch11Section_5_6c">
-        The name of the command or function, followed by a one-line description of what it does.
-       </p>
-       SYNOPSIS
-       <p id="ch11Section_5_6d">
-        In the case of a command, you get a formal description of how to run it and what command line options it takes. For program functions, a list of the parameters the function takes and which header file contains its definition. For experienced users, this may be all the documentation they need.
-       </p>
-       DESCRIPTION
-       <p id="ch11Section_5_6e">
-        A textual description of the functioning of the command or function.
-       </p>
-       EXAMPLES
-       <p id="ch11Section_5_6f">
-        Some examples of common usage.
-       </p>
-       SEE ALSO
-       <p id="ch11Section_5_70">
-        A list of related commands or functions.
-       </p>
-       <p id="ch11Section_5_71">
-        Other sections may be present, but these are not well standardized across man pages. Common examples include: OPTIONS, EXIT STATUS, ENVIRONMENT, KNOWN BUGS, FILES, AUTHOR, REPORTING BUGS, HISTORY and COPYRIGHT.
-       </p>
-       <p id="ch11Section_5_72">
-        These days virtually every Unix command line application comes with its man page, and many Unix users perceive a lack of man pages as a sign of low quality; indeed, some projects, such as Debian, go out of their way to write man pages for programs lacking one. Few alternatives to
-        <span class="emphasis">
-         <em>
-          man
-         </em>
-        </span>
-        have enjoyed much popularity, with the possible exception of the GNU project's "info" system, an early and simple hypertext system.
-       </p>
-       <p id="ch11Section_5_73">
-        However, the format of a single page for each application, the lack of classification within the sections and the relatively unsophisticated formatting facilities have motivated the development of alternative documentation systems, such as the previously mentioned "info" system.
-       </p>
-       <p id="ch11Section_5_74">
-        Most Unix GUI applications (particularly those built using the GNOME and KDE development environments) now provide end-user documentation in HTML and include embedded HTML viewers such as yelp for reading the help within the application.
-       </p>
-       <p id="ch11Section_5_75">
-        Usually the man pages are written in English. Translations into other languages can be also available on the system.
-       </p>
-       <p id="ch11Section_5_76">
-        The default format of the man pages is troff, with either the macro package man (appearance oriented) or on some systems mdoc (semantic oriented). This makes it possible to typeset a man page to PostScript, PDF and various other formats for viewing or printing.
-       </p>
-      </div>
+      <pre class="programlisting">
+       #!/bin/sh
+name=`find . -name $1 -print`
+echo $name
+last_modified=`stat -c %y $name| cut -f 1 -d " "`
+echo "Last modified: $last_modified"
+$ ./search.sh fname
+      </pre>
+      <p id="ch11Section_5_4a">
+       Try giving some file you want to search in place of fname. Please note in second line
+       <span class="emphasis">
+        <em>
+         `
+        </em>
+       </span>
+       its a back-quote(other key mapped with tilda), it is specifically used to get the output of one command into a variable. In this particular case name is a User defined variables (UDV) which stores the value. We access value stored in any variable using
+       <span class="emphasis">
+        <em>
+         $
+        </em>
+       </span>
+       symbol before name of variable.
+      </p>
+      <p id="ch11Section_5_4b">
+       naming conventions for variables?? do we need them??
+      </p>
      </div>
-     <div class="section" title="4.3.info">
+     <div class="section" title="6.2.Shell Arithmetic:">
       <div class="titlepage">
        <div>
         <div>
          <h3 class="title">
-          <a name="id2946679">
+          <a name="id2855367">
           </a>
-          4.3.info
+          6.2.Shell Arithmetic:
          </h3>
         </div>
        </div>
       </div>
-      <p id="ch11Section_5_77">
-       <span class="emphasis">
-        <em>
-         info
-        </em>
-       </span>
-       is a software utility which forms a hypertextual, multipage documentation and help viewer working on a command line interface, useful when there is no GUI available.
+      <p id="ch11Section_5_4c">
+       Shell also provides support for basic arithmetic operations. The syntax is:
+      </p>
+      <pre class="programlisting">
+       $ expr op1 math-operator op2
+      </pre>
+      <p id="ch11Section_5_4d">
+       Some of example which can be tried handily:
       </p>
-      <p id="ch11Section_5_78">
-       The syntax is
+      <pre class="programlisting">
+       $ expr -3 + 5
+2
+$ expr 10 % 3
+1
+      </pre>
+      <p id="ch11Section_5_4e">
+       These spaces in between operator and operands is important, without them shell interpreter will raise the syntax error.
       </p>
       <pre class="programlisting">
-       $ info &lt;command_name&gt;
+       $ expr 2*3
+expr: syntax error
       </pre>
-      <p id="ch11Section_5_79">
-       <span class="emphasis">
-        <em>
-         info
-        </em>
-       </span>
-       processes info files, which are Texinfo formatted files, and presents the documentation as a tree, with simple commands to traverse the tree and to follow cross references. For instance
+      <p id="ch11Section_5_4f">
+       One can use back-quotes(`) also to get value of expr.
+      </p>
+      <pre class="programlisting">
+       $ echo `expr 6 + 3`
+9
+$ result=`expr 6 + 3`
+$ echo $result
+9
+      </pre>
+      <p id="ch11Section_5_50">
+       Shell uses three kinds of quotes. Double quotes("), anything enclosed among them except from variable trailing after $, and characters after would be printed as it is. Single quotes('), anything enclosed within them is just same, no formulation/interpretation. Back quotes(`), anything inclosed is considered as command, or is executed.
       </p>
-      <div class="itemizedlist">
-       <ul class="itemizedlist" type="*">
-        <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_7a">
-          <span class="emphasis">
-           <em>
-            n
-           </em>
-          </span>
-          goes to the next page.
-         </p>
-        </li>
-        <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_7b">
-          <span class="emphasis">
-           <em>
-            p
-           </em>
-          </span>
-          goes to the previous page.
-         </p>
-        </li>
-        <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_7c">
-          <span class="emphasis">
-           <em>
-            u
-           </em>
-          </span>
-          goes to the upper page.
-         </p>
-        </li>
-        <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_7d">
-          <span class="emphasis">
-           <em>
-            l
-           </em>
-          </span>
-          goes to the last(visited) node
-         </p>
-        </li>
-        <li class="listitem" style="list-style-type: *">
-         <p id="ch11Section_5_7e">
-          To follow a cross reference, the cursor can be moved over a link (a word preceded by a *) and enter pressed.
-         </p>
-        </li>
-       </ul>
-      </div>
-      <p id="ch11Section_5_7f">
-       info was initially written for use with GNU/Linux and then ported to other Unix-like operating systems.
-      </p>
+      <pre class="programlisting">
+       $ echo "Today is date"
+Today is date
+$ echo "Today is `date`"
+Today is Wed Sep 16 17:32:22 IST 2009
+$ echo 'Today is `date`'
+Today is `date`
+$ echo "Today is  n `date`"
+Today is  n Wed Sep 16 17:40:13 IST 2009
+$ echo -e "Today is  n `date`"
+Today is
+ Wed Sep 16 17:41:13 IST 2009
+      </pre>
      </div>
-     <div class="section" title="4.4.--help">
+     <div class="section" title="6.3.if else construct:">
       <div class="titlepage">
        <div>
         <div>
          <h3 class="title">
-          <a name="id2946765">
+          <a name="id2857386">
           </a>
-          4.4.--help
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_80">
-       Most GNU commands support the --help, which gives a short explanation about how to use the command and a list of available options. Below is the output of this option with the
-       <span class="emphasis">
-        <em>
-         cat
-        </em>
-       </span>
-       command:
-      </p>
-      <pre class="programlisting">
-       $ userprompt@host: cat --help
-Usage: cat [OPTION] [FILE]...
-Concatenate FILE(s), or standard input, to standard output.
-
-  -A, --show-all           equivalent to -vET
-  -b, --number-nonblank    number nonempty output lines
-  -e                       equivalent to -vE
-  -E, --show-ends          display $ at end of each line
-  -n, --number             number all output lines
-  -s, --squeeze-blank      suppress repeated empty output lines
-  -t                       equivalent to -vT
-  -T, --show-tabs          display TAB characters as ^I
-  -u                       (ignored)
-  -v, --show-nonprinting   use ^ and M- notation, except for LFD and              TAB
-  --help     display this help and exit
-  --version  output version information and exit
-
-With no FILE, or when FILE is -, read standard input.
-
-Examples:
-  cat f - g  Output f's contents, then standard input, then g's           contents.
-  cat        Copy standard input to standard output.
-
-Report bugs to &lt;bug-coreutils@gnu.org&gt;.
-      </pre>
-     </div>
-    </div>
-    <div class="section" title="5.Basic file handling">
-     <div class="titlepage">
-      <div>
-       <div>
-        <h2 class="title" style="clear: both">
-         <a name="id2946817">
-         </a>
-         5.Basic file handling
-        </h2>
-       </div>
-      </div>
-     </div>
-     <div class="section" title="5.1.cp">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2946826">
-          </a>
-          5.1.cp
+          6.3.if else construct:
          </h3>
         </div>
        </div>
       </div>
-      <p id="ch11Section_5_81">
+      <p id="ch11Section_5_51">
+       One can have simple
+       <span class="emphasis">
+        <em>
+         if else if
+        </em>
+       </span>
+       constructs in shell scripts to check conditions. Lets take simple example of writing a script which returns back whether the argument passed is positive or not:
+      </p>
+      <pre class="programlisting">
+       #!/bin/sh
+if test $1 -gt 0
+then
+  echo "number is positive"
+else
+  echo "number is negative"
+fi
+$ ./sign.sh -11
+number is negative
+      </pre>
+      <p id="ch11Section_5_52">
+       This script will compare the first value passed as argument with 0
        <span class="emphasis">
         <em>
-         cp
+         if test var -gt val
+        </em>
+       </span>
+       , var being $1 and val being 0, gt meaning greater then. Now this program has some flaw, it will give same result for following input: (-11) and (-1, 5), as we are checking just $1 which is first argument and hence the result. For handling such situation we can include
+       <span class="emphasis">
+        <em>
+         if-else
+        </em>
+       </span>
+       clause which will warn user of correct usage of script.
+      </p>
+      <pre class="programlisting">
+       #this is the case when no argument is passed
+if [ $# -eq 0 ]
+then
+  echo "$0 : You must give/supply one integers"
+  exit 1
+else
+  if [ $# -gt 1 ]
+  then
+    echo "$0 : You must give one integer"
+    exit 1
+  fi
+fi
+      </pre>
+      <p id="ch11Section_5_53">
+       One important thing to not in shell script is spacing, with many comparison and evaluation operation a wrongly placed space will spoil all the fun. So in previous example the expression
+       <span class="emphasis">
+        <em>
+         [ $# -eq 0 ]
         </em>
        </span>
-       is the command entered in a Unix shell to copy a file from one place to another, possibly on a different filesystem. The original file remains unchanged, and the new file may have the same or a different name.
+       will work properly, but if we remove those leading or trailing spaces like
+       <span class="emphasis">
+        <em>
+         [ $# -eq 0]
+        </em>
+       </span>
+       , it wont work as expected, or rather throw a warning. Both
+       <span class="emphasis">
+        <em>
+         test
+        </em>
+       </span>
+       and
+       <span class="emphasis">
+        <em>
+         []
+        </em>
+       </span>
+       do the same task of testing a expression and returning true or false.
       </p>
-      <div class="section" title="5.1.1.Usage">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2946843">
-           </a>
-           5.1.1.Usage
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_82">
-        To copy a file to another file:
-       </p>
-       <pre class="programlisting">
-        $ cp [ -f ] [ -H ] [ -i ] [ -p ][ -- ] SourceFile TargetFile
-       </pre>
-       <p id="ch11Section_5_83">
-        To copy a file to a directory:
-       </p>
-       <pre class="programlisting">
-        $ cp [ -f ] [ -H ] [ -i ] [ -p ] [ -r | -R ] [ -- ] SourceFile ...              TargetDirectory
-       </pre>
-       <p id="ch11Section_5_84">
-        To copy a directory to a directory:
-       </p>
-       <pre class="programlisting">
-        $ cp [ -f ] [ -H ] [ -i ] [ -p ] [ -- ] { -r | -R }
-SourceDirectory ... TargetDirectory
-       </pre>
-      </div>
-      <div class="section" title="5.1.2.Flags">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2946877">
-           </a>
-           5.1.2.Flags
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_85">
-        <span class="emphasis">
-         <em>
-          -f
-         </em>
-        </span>
-        (force)  specifies removal of the target file if it cannot be opened for write operations. The removal precedes any copying performed by the cp command.
-       </p>
-       <p id="ch11Section_5_86">
-        <span class="emphasis">
-         <em>
-          -P
-         </em>
-        </span>
-        makes the cp command copy symbolic links. The default is to follow symbolic links, that is, to copy files to which symbolic links point.
-       </p>
-       <p id="ch11Section_5_87">
-        <span class="emphasis">
-         <em>
-          -i
-         </em>
-        </span>
-        (interactive)  prompts you with the name of a file to be overwritten. This occurs if the TargetDirectory or TargetFile parameter contains a file with the same name as a file specified in the SourceFile or SourceDirectory parameter. If you enter y or the locale's equivalent of y, the cp command continues. Any other answer prevents the cp command from overwriting the file.
-       </p>
-       <p id="ch11Section_5_88">
-        <span class="emphasis">
-         <em>
-          -p
-         </em>
-        </span>
-        (preserve)  duplicates the following characteristics of each SourceFile/SourceDirectory in the corresponding TargetFile and/or TargetDirectory:
-       </p>
-       <div class="itemizedlist">
-        <ul class="itemizedlist" type="*">
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_89">
-           The time of the last data modification and the time of the last access.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_8a">
-           The user ID and group ID (only if it has permissions to do this)
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_8b">
-           The file permission bits and the SUID and SGID bits.
-          </p>
-         </li>
-        </ul>
-       </div>
-       <p id="ch11Section_5_8c">
-        <span class="emphasis">
-         <em>
-          -R
-         </em>
-        </span>
-        (recursive)  copy directories (recursively copying all the contents)
-       </p>
-      </div>
-      <div class="section" title="5.1.3.Examples">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2946974">
-           </a>
-           5.1.3.Examples
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_8d">
-        To make a copy of a file in the current directory, enter:
-       </p>
-       <pre class="programlisting">
-        $ cp prog.c prog.bak
-       </pre>
-       <p id="ch11Section_5_8e">
-        This copies prog.c to prog.bak. If the prog.bak file does not already exist, the cp command creates it. If it does exist, the cp command replaces it with a copy of the prog.c file.
-       </p>
-       <p id="ch11Section_5_8f">
-        To copy a file in your current directory into another directory, enter:
-       </p>
-       <pre class="programlisting">
-        $ cp zaphod /home/books/hhgg
-       </pre>
-       <p id="ch11Section_5_90">
-        This copies the jones file to /home/books/hhgg/zaphod.
-       </p>
-       <p id="ch11Section_5_91">
-        To copy a file to a new file and preserve the modification date, time, and access control list associated with the source file, enter:
-       </p>
-       <pre class="programlisting">
-        $ cp -p martin_luther_king martin_luther_king.jr
-       </pre>
-       <p id="ch11Section_5_92">
-        This copies the
-        <span class="emphasis">
-         <em>
-          martin_luther_king
-         </em>
-        </span>
-        file to the
-        <span class="emphasis">
-         <em>
-          martin_luther_king.jr
-         </em>
-        </span>
-        file. Instead of creating the file with the current date and time stamp, the system gives the
-        <span class="emphasis">
-         <em>
-          martin_luther_king.jr
-         </em>
-        </span>
-        file the same date and time as the
-        <span class="emphasis">
-         <em>
-          martin_luther_king
-         </em>
-        </span>
-        file. The
-        <span class="emphasis">
-         <em>
-          martin_luther_king.jr
-         </em>
-        </span>
-        file also inherits the
-        <span class="emphasis">
-         <em>
-          martin_luther_king
-         </em>
-        </span>
-        file's access control protection.
-       </p>
-       <p id="ch11Section_5_93">
-        To copy all the files in a directory to a new directory, enter:
-       </p>
-       <pre class="programlisting">
-        $ cp /home/galactica/clients/* /home/hhgg/customers
-       </pre>
-       <p id="ch11Section_5_94">
-        This copies only the files in the clients directory to the customers directory.
-       </p>
-       <p id="ch11Section_5_95">
-        To copy a directory, including all its files and subdirectories, to another directory, enter:
-       </p>
-       <p id="ch11Section_5_96">
-        $ cp -R /home/hhgg/clients /home/hhgg/customers
-       </p>
-       <p id="ch11Section_5_97">
-        This copies the clients directory, including all its files, subdirectories, and the files in those subdirectories, to the customers/clients directory.
-       </p>
-       <p id="ch11Section_5_98">
-        To copy a specific set of files of any extension to another directory, enter:
-       </p>
-       <pre class="programlisting">
-        $ cp zaphod arthur ford /home/hhgg/clients
-       </pre>
-       <p id="ch11Section_5_99">
-        This copies the
-        <span class="emphasis">
-         <em>
-          zaphod
-         </em>
-        </span>
-        ,
-        <span class="emphasis">
-         <em>
-          arthur
-         </em>
-        </span>
-        , and
-        <span class="emphasis">
-         <em>
-          ford
-         </em>
-        </span>
-        files in your current working directory to the /home/hhgg/clients directory.
-       </p>
-       <p id="ch11Section_5_9a">
-        To use pattern-matching characters to copy files, enter:
-       </p>
-       <pre class="programlisting">
-        $ cp programs/*.py .
-       </pre>
-       <p id="ch11Section_5_9b">
-        This copies the files in the programs directory that end with
-        <span class="emphasis">
-         <em>
-          .py
-         </em>
-        </span>
-        to the current directory, signified by the single "." (dot). You must type a space between the
-        <span class="emphasis">
-         <em>
-          py
-         </em>
-        </span>
-        and the final dot.
-       </p>
-      </div>
+      <p id="ch11Section_5_54">
+       Lets create something interesting using these if-else clause. Now we will create a script which will greet the user when he opens the shell. We will create the script, change the permission to make it executable and append the
+       <span class="emphasis">
+        <em>
+         .bashrc
+        </em>
+       </span>
+       file with
+       <span class="emphasis">
+        <em>
+         ./greet.sh
+        </em>
+       </span>
+       line and we are done. The script is:
+      </p>
+      <pre class="programlisting">
+       #!/bin/sh
+#Script to greet the user according to time of day
+temph=`date | cut -c12-13`
+dat=`date +"%A %d in %B of %Y (%r)"`
+if [ $temph -lt 12 ]
+then
+  mess="Good Morning $LOGNAME, Have a nice day!"
+fi
+
+if [ $temph -gt 12 -a $temph -le 16 ]
+then
+  mess="Good Afternoon $LOGNAME"
+fi
+
+if [ $temph -gt 16 -a $temph -le 18 ]
+then
+  mess="Good Evening $LOGNAME"
+fi
+echo -e "$mess nThis is $dat"
+      </pre>
+      <p id="ch11Section_5_55">
+       For me when I open the shell the output is something like:
+      </p>
+      <pre class="programlisting">
+       Good Morning baali, Have a nice day!
+This is Wednesday 16 in September of 2009 (11:54:47 AM IST)
+      </pre>
      </div>
-     <div class="section" title="5.2.mv">
+     <div class="section" title="6.4.Loops">
       <div class="titlepage">
        <div>
         <div>
          <h3 class="title">
-          <a name="id2947135">
+          <a name="id2857492">
           </a>
-          5.2.mv
+          6.4.Loops
          </h3>
         </div>
        </div>
       </div>
-      <p id="ch11Section_5_9c">
-       <span class="emphasis">
-        <em>
-         mv
-        </em>
-       </span>
-       (short for move) is a Unix command that moves one or more files or directories from one place to another. The original file is deleted, and the new file may have the same or a different name. If possible (i.e. when the original and new files are on the same file system),
-       <span class="emphasis">
-        <em>
-         mv
-        </em>
-       </span>
-       will rename the file instead. Write permission is required on all directories being modified.
+      <p id="ch11Section_5_56">
+       Bash has three different commands for looping --
+       <code class="literal">
+        for
+       </code>
+       ,
+       <code class="literal">
+        while
+       </code>
+       and
+       <code class="literal">
+        until
+       </code>
+       .
       </p>
-      <div class="section" title="5.2.1.Conflicting existing file">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2947159">
-           </a>
-           5.2.1.Conflicting existing file
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_9d">
-        In all cases, when a file is moved to have the name of an existing file (in the same directory), the existing file is deleted. If the existing file is not writable but is in a directory that is writable, then the mv command asks for confirmation if possible (i.e. if run from a terminal) before proceeding, unless the -f (force) option is used.
-       </p>
-      </div>
-      <div class="section" title="5.2.2.Differences with copy and delete">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2947178">
-           </a>
-           5.2.2.Differences with copy and delete
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_9e">
-        Note that, usually, when moving files within the same volume, moving (and/or renaming) is not the same as simply copying and then deleting the original. When moving a file, the link is simply removed from the old parent directory and added to the new parent directory. However, the file itself is untouched (i.e. it has the same inodes and resides at the same place on the disk). For example, you cannot copy a file you cannot read, but you can move (and/or rename) it (provided you have write permission to its old and new parent directories). Also, suppose there is a non-empty directory you do not have write permission to. You cannot delete this directory (since you cannot delete its contents); but you can move (and/or rename) it. Also, since moving between filenames on a single volume does not involve copying, it is faster and does not place strain of lots of reads and writes on the disk. Moving files across different volumes, however, does necessitate copying and deleting.
-       </p>
-      </div>
-      <div class="section" title="5.2.3.Examples">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2944863">
-           </a>
-           5.2.3.Examples
-          </h4>
-         </div>
-        </div>
-       </div>
-       <pre class="programlisting">
-        $ mv myfile mynewfilename    renames a file
-$ mv myfile otherfilename    renames a file and deletes the existing            file "myfile"
-$ mv myfile /myfile          moves 'myfile' from the current            directory to the root directory
-$ mv myfile dir/myfile       moves 'myfile' to 'dir/myfile' relative            to the current directory
-$ mv myfile dir              same as the previous command (the          filename is implied to be the same)
-$ mv myfile dir/myfile2      moves 'myfile' to dir and renames it to            'myfile2'
-$ mv foo bar baz dir         moves multiple files to directory dir
-$ mv --help                  shows a very concise help about the                syntax of the command
-$ man mv                     prints an extensive user manual for                'mv' in the terminal
-       </pre>
-       <p id="ch11Section_5_9f">
-        In all cases, the file or files being moved or renamed can be a directory.
-       </p>
-       <p id="ch11Section_5_a0">
-        Note that when the command is called with two arguments (as
-        <span class="emphasis">
-         <em>
-          mv name1 name2
-         </em>
-        </span>
-        or
-        <span class="emphasis">
-         <em>
-          mv name1 /dir/name2
-         </em>
-        </span>
-        ), it can have three different effects, depending on whether
-        <span class="emphasis">
-         <em>
-          name2
-         </em>
-        </span>
-        does not exist, is an existing file, or is an existing directory. If the user intends to refer to an existing directory,
-        <span class="emphasis">
-         <em>
-          /.
-         </em>
-        </span>
-        (or in some Unix versions
-        <span class="emphasis">
-         <em>
-          /
-         </em>
-        </span>
-        is sufficient) may be appended to the name to force the system to check this. To move a file to a new directory, the directory must be created first.
-       </p>
-      </div>
-     </div>
-     <div class="section" title="5.3.rm">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2944921">
-          </a>
-          5.3.rm
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_a1">
-       <span class="emphasis">
-        <em>
-         rm
-        </em>
-       </span>
-       (short for "remove") is one of several basic Unix command lines that operates on files. It is used to delete files from a filesystem. The data is not actually destroyed. Only the index listing where the file is stored is destroyed, and the storage is made available for reuse. There are undelete utilities that will attempt to reconstruct the index and can bring the file back if the parts were not reused.
-      </p>
-      <p id="ch11Section_5_a2">
-       Here's example to remove a file named "foo" from a directory, here shown with the -i option:
-      </p>
-      <pre class="programlisting">
-       $ rm -i foo
-remove foo? y
-      </pre>
-      <div class="section" title="5.3.1.Options">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2944951">
-           </a>
-           5.3.1.Options
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_a3">
-        Common options that rm accepts include:
-       </p>
-       <div class="itemizedlist">
-        <ul class="itemizedlist" type="*">
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_a4">
-           <span class="emphasis">
-            <em>
-             -r
-            </em>
-           </span>
-           , which removes directories, removing the contents recursively beforehand (so as not to leave files without a directory to reside in) ("recursive")
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_a5">
-           <span class="emphasis">
-            <em>
-             -i
-            </em>
-           </span>
-           , which asks for every deletion to be confirmed ("interactive")
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_a6">
-           <span class="emphasis">
-            <em>
-             -f
-            </em>
-           </span>
-           , which ignores non-existent files and overrides any confirmation prompts ("force")
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_a7">
-           <span class="emphasis">
-            <em>
-             -v
-            </em>
-           </span>
-           , which shows what is being removed as it happens ("verbose")
-          </p>
-         </li>
-        </ul>
-       </div>
-       <p id="ch11Section_5_a8">
-        <span class="emphasis">
-         <em>
-          rm
-         </em>
-        </span>
-        is often aliased to "rm -i" so as to avoid accidental deletion of files. If a user still wishes to delete a large number of files without confirmation, they can manually cancel out the -i argument by adding the -f option (as the option specified later on the expanded command line "rm -i -f" takes precedence).
-       </p>
-       <p id="ch11Section_5_a9">
-        <span class="emphasis">
-         <em>
-          rm -rf
-         </em>
-        </span>
-        (variously, rm -rf /, rm -rf *, and others) is frequently used in jokes and anecdotes about Unix disasters. The rm -rf variant of the command, if run by a superuser on the root directory, would cause the contents of every writable mounted filesystem on the computer to be deleted.
-       </p>
-       <p id="ch11Section_5_aa">
-        <span class="emphasis">
-         <em>
-          rm
-         </em>
-        </span>
-        is often used in conjunction with xargs to supply a list of files to delete:
-       </p>
-       <pre class="programlisting">
-        xargs rm &lt; filelist
-       </pre>
-       <p id="ch11Section_5_ab">
-        When
-        <span class="emphasis">
-         <em>
-          rm
-         </em>
-        </span>
-        is used on a symbolic link, it deletes the link, but does not affect the target of the link.
-       </p>
-      </div>
-      <div class="section" title="5.3.2.Permissions">
+      <div class="section" title="6.4.1.for loop">
        <div class="titlepage">
         <div>
          <div>
           <h4 class="title">
-           <a name="id2947530">
-           </a>
-           5.3.2.Permissions
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_ac">
-        Usually, on most filesystems, deleting a file requires write permission on the parent directory (and execute permission, in order to enter the directory in the first place). (Note that, confusingly for beginners, permissions on the file itself are irrelevant. However, GNU rm asks for confirmation if a write-protected file is to be deleted, unless the -f option is used.)
-       </p>
-       <p id="ch11Section_5_ad">
-        To delete a directory (with rm -r), one must delete all of its contents recursively. This requires that one must have read and write and execute permission to that directory (if it's not empty) and all non-empty subdirectories recursively (if there are any). The read permissions are needed to list the contents of the directory in order to delete them. This sometimes leads to an odd situation where a non-empty directory cannot be deleted because one doesn't have write permission to it and so cannot delete its contents; but if the same directory were empty, one would be able to delete it.
-       </p>
-       <p id="ch11Section_5_ae">
-        If a file resides in a directory with the sticky bit set, then deleting the file requires one to be the owner of the file.
-       </p>
-      </div>
-     </div>
-    </div>
-    <div class="section" title="6.Command Line Arguments">
-     <div class="titlepage">
-      <div>
-       <div>
-        <h2 class="title" style="clear: both">
-         <a name="id2947569">
-         </a>
-         6.Command Line Arguments
-        </h2>
-       </div>
-      </div>
-     </div>
-     <p id="ch11Section_5_af">
-      In computer command line interfaces, a command line argument is an argument sent to a program being called. In general, a program can take any number of command line arguments, which may be necessary for the program to run, or may even be ignored, depending on the function of that program.
-     </p>
-     <p id="ch11Section_5_b0">
-      For example, in Unix and Unix-like environments, an example of a command-line argument is:
-     </p>
-     <pre class="programlisting">
-      rm file.s
-     </pre>
-     <p id="ch11Section_5_b1">
-      "file.s" is a command line argument which tells the program rm to remove the file "file.s".
-     </p>
-     <p id="ch11Section_5_b2">
-      Programming languages such as C, C++ and Java allow a program to interpret the command line arguments by handling them as string parameters in the main function.
-     </p>
-     <p id="ch11Section_5_b3">
-      A command line option or simply
-      <span class="emphasis">
-       <em>
-        option
-       </em>
-      </span>
-      (also known as a command line parameter, flag, or a switch) is an indication by a user that a computer program should change its default output.
-     </p>
-     <p id="ch11Section_5_b4">
-      Long options are introduced via "--", and are typically whole words. For example,
-      <span class="emphasis">
-       <em>
-        ls --long --classify --all
-       </em>
-      </span>
-      . Arguments to long options are provided with "=", as
-      <span class="emphasis">
-       <em>
-        ls --block-size=1024
-       </em>
-      </span>
-      . Some Unix programs use long options with single dashes, for example MPlayer as in
-      <span class="emphasis">
-       <em>
-        mplayer -nosound
-       </em>
-      </span>
-      .
-     </p>
-     <p id="ch11Section_5_b5">
-      Linux also uses "--" to terminate option lists. For example, an attempt to delete a file called
-      <span class="emphasis">
-       <em>
-        -file1
-       </em>
-      </span>
-      by using
-      <span class="emphasis">
-       <em>
-        rm -file1
-       </em>
-      </span>
-      may produce an error, since rm may interpret
-      <span class="emphasis">
-       <em>
-        -file1
-       </em>
-      </span>
-      as a command line switch. Using
-      <span class="emphasis">
-       <em>
-        rm -- -file1
-       </em>
-      </span>
-      removes ambiguity.
-     </p>
-    </div>
-    <div class="section" title="7.Basic Text Processing">
-     <div class="titlepage">
-      <div>
-       <div>
-        <h2 class="title" style="clear: both">
-         <a name="id2947661">
-         </a>
-         7.Basic Text Processing
-        </h2>
-       </div>
-      </div>
-     </div>
-     <div class="section" title="7.1.head">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2947670">
-          </a>
-          7.1.head
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_b6">
-       <span class="emphasis">
-        <em>
-         head
-        </em>
-       </span>
-       is a program on Unix and Unix-like systems used to display the first few lines of a text file or piped data. The command syntax is:
-      </p>
-      <pre class="programlisting">
-       $ head [options] &lt;file_name&gt;
-      </pre>
-      <p id="ch11Section_5_b7">
-       By default,
-       <span class="emphasis">
-        <em>
-         head
-        </em>
-       </span>
-       will print the first 10 lines of its input to the standard output. The number of lines printed may be changed with a command line option. The following example shows the first 20 lines of filename:
-      </p>
-      <pre class="programlisting">
-       $ head -n 20 filename
-      </pre>
-      <p id="ch11Section_5_b8">
-       This displays the first 5 lines of all files starting with
-       <span class="emphasis">
-        <em>
-         foo
-        </em>
-       </span>
-       :
-      </p>
-      <pre class="programlisting">
-       $ head -n 5 foo*
-      </pre>
-      <p id="ch11Section_5_b9">
-       Some versions omit the n and just let you say -5.
-      </p>
-      <div class="section" title="7.1.1.Flags">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2947721">
-           </a>
-           7.1.1.Flags
-          </h4>
-         </div>
-        </div>
-       </div>
-       <pre class="programlisting">
-        -c &lt;x number of bytes&gt; Copy first x number of bytes.
-       </pre>
-       <p id="ch11Section_5_ba">
-        Other options:
-        <span class="emphasis">
-         <em>
-          sed
-         </em>
-        </span>
-       </p>
-       <p id="ch11Section_5_bb">
-        Many early versions of Unix did not have this command, and so documentation and books had
-        <span class="emphasis">
-         <em>
-          sed
-         </em>
-        </span>
-        do this job:
-       </p>
-       <pre class="programlisting">
-        sed 5q foo
-       </pre>
-       <p id="ch11Section_5_bc">
-        This says to print every line (implicit), and quit after the fifth.
-       </p>
-      </div>
-     </div>
-     <div class="section" title="7.2.tail">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2947756">
-          </a>
-          7.2.tail
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_bd">
-       <span class="emphasis">
-        <em>
-         tail
-        </em>
-       </span>
-       is a program on Unix and Unix-like systems used to display the last few lines of a text file or piped data.
-      </p>
-      <p id="ch11Section_5_be">
-       The command-syntax is:
-      </p>
-      <pre class="programlisting">
-       $ tail [options] &lt;file_name&gt;
-      </pre>
-      <p id="ch11Section_5_bf">
-       By default,
-       <span class="emphasis">
-        <em>
-         tail
-        </em>
-       </span>
-       will print the last 10 lines of its input to the standard output. With command line options the number of lines printed and the printing units (lines, blocks or bytes) may be changed. The following example shows the last 20 lines of filename:
-      </p>
-      <pre class="programlisting">
-       $ tail -n 20 filename
-      </pre>
-      <p id="ch11Section_5_c0">
-       This example shows the last 15 bytes of all files starting with
-       <span class="emphasis">
-        <em>
-         foo
-        </em>
-       </span>
-       :
-      </p>
-      <pre class="programlisting">
-       $ tail -c 15 foo*
-      </pre>
-      <p id="ch11Section_5_c1">
-       This example shows all lines of filename from the second line onwards:
-      </p>
-      <pre class="programlisting">
-       $ tail -n +2 filename
-      </pre>
-      <p id="ch11Section_5_c2">
-       Using an older syntax (still used in Sun Solaris as the -n option is not supported), the last 20 lines and the last 50 bytes of filename can be shown with the following command:
-      </p>
-      <pre class="programlisting">
-       $ tail -20 filename
-$ tail -50c filename
-      </pre>
-      <p id="ch11Section_5_c3">
-       However this syntax is now obsolete and does not conform with the POSIX 1003.1-2001 standard. Even if still supported in current versions, when used with other options (like -f, see below), these switches could not work at all.
-      </p>
-      <div class="section" title="7.2.1.File monitoring">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2947834">
+           <a name="id2857514">
            </a>
-           7.2.1.File monitoring
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_c4">
-        <span class="emphasis">
-         <em>
-          tail
-         </em>
-        </span>
-        has a special command line option
-        <span class="emphasis">
-         <em>
-          -f
-         </em>
-        </span>
-        (follow) that allows a file to be monitored. Instead of displaying the last few lines and exiting, tail displays the lines and then monitors the file. As new lines are added to the file by another process, tail updates the display. This is particularly useful for monitoring log files. The following command will display the last 10 lines of messages and append new lines to the display as new lines are added to messages:
-       </p>
-       <pre class="programlisting">
-        $ tail -f /var/adm/messages
-       </pre>
-       <p id="ch11Section_5_c5">
-        To interrupt tail while it is monitoring, break-in with
-        <span class="emphasis">
-         <em>
-          Ctrl+C
-         </em>
-        </span>
-        . This command can be run "in the background" with &amp;, see job control.
-       </p>
-       <p id="ch11Section_5_c6">
-        If you have a command's result to monitor, you can use the
-        <span class="emphasis">
-         <em>
-          watch
-         </em>
-        </span>
-        command.
-       </p>
-      </div>
-     </div>
-     <div class="section" title="7.3.cut">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2947883">
-          </a>
-          7.3.cut
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_c7">
-       In computing,
-       <span class="emphasis">
-        <em>
-         cut
-        </em>
-       </span>
-       is a Unix command line utility which is used to extract sections from each line of input  usually from a file.
-      </p>
-      <p id="ch11Section_5_c8">
-       Extraction of line segments can typically be done by
-       <span class="emphasis">
-        <em>
-         bytes (-b), characters (-c)
-        </em>
-       </span>
-       , or
-       <span class="emphasis">
-        <em>
-         fields (-f)
-        </em>
-       </span>
-       separated by a
-       <span class="emphasis">
-        <em>
-         delimiter (-d  the tab character by default)
-        </em>
-       </span>
-       . A range must be provided in each case which consists of one of N, N-M, N- (N to the end of the line), or -M (beginning of the line to M), where N and M are counted from 1 (there is no zeroth value). Since version 6, an error is thrown if you include a zeroth value. Prior to this the value was ignored and assumed to be 1.
-      </p>
-      <p id="ch11Section_5_c9">
-       Assuming a file named file containing the lines:
-      </p>
-      <pre class="programlisting">
-       foo:bar:baz:qux:quux
-one:two:three:four:five:six:seven
-alpha:beta:gamma:delta:epsilon:zeta:eta:teta:iota:kappa:lambda:mu
-      </pre>
-      <p id="ch11Section_5_ca">
-       To output the fourth through tenth characters of each line:
-      </p>
-      <pre class="programlisting">
-       $ cut -c 4-10 file
-      </pre>
-      <p id="ch11Section_5_cb">
-       This gives the output:
-      </p>
-      <pre class="programlisting">
-       :bar:ba
-:two:th
-ha:beta
-      </pre>
-      <p id="ch11Section_5_cc">
-       To output the fifth field through the end of the line of each line using the colon character as the field delimiter:
-      </p>
-      <pre class="programlisting">
-       $ cut -d : -f 5- file
-      </pre>
-      <p id="ch11Section_5_cd">
-       This gives the output:
-      </p>
-      <pre class="programlisting">
-       quux
-five:six:seven
-epsilon:zeta:eta:teta:iota:kappa:lambda:mu
-      </pre>
-     </div>
-     <div class="section" title="7.4.paste">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2947969">
-          </a>
-          7.4.paste
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_ce">
-       <span class="emphasis">
-        <em>
-         paste
-        </em>
-       </span>
-       is a Unix command line utility which is used to join files horizontally (parallel merging) by outputting lines consisting of the sequentially corresponding lines of each file specified, separated by tabs, to the standard output. It is effectively the horizontal equivalent to the utility
-       <span class="emphasis">
-        <em>
-         cat
-        </em>
-       </span>
-       command which operates on the vertical plane of two or more files.
-      </p>
-      <p id="ch11Section_5_cf">
-       To paste several columns of data together into the file
-       <span class="emphasis">
-        <em>
-         www
-        </em>
-       </span>
-       from files
-       <span class="emphasis">
-        <em>
-         who
-        </em>
-       </span>
-       ,
-       <span class="emphasis">
-        <em>
-         where
-        </em>
-       </span>
-       , and
-       <span class="emphasis">
-        <em>
-         when
-        </em>
-       </span>
-       :
-      </p>
-      <pre class="programlisting">
-       $ paste who where when &gt; www
-      </pre>
-      <p id="ch11Section_5_d0">
-       If the files contain:
-      </p>
-      <table summary="paste" border="1">
-       <colgroup>
-        <col width="11">
-        </col>
-        <col width="12">
-        </col>
-        <col width="12">
-        </col>
-       </colgroup>
-      </table>
-      <p id="ch11Section_5_dd">
-       This creates the file named
-       <span class="emphasis">
-        <em>
-         www
-        </em>
-       </span>
-       containing:
-      </p>
-      <pre class="programlisting">
-       Batman            GothamCity       January 3
-Trillian          Andromeda        February 4
-Jeeves            London           March 19
-      </pre>
-     </div>
-    </div>
-    <div class="section" title="8.Shell Meta Characters">
-     <div class="titlepage">
-      <div>
-       <div>
-        <h2 class="title" style="clear: both">
-         <a name="id2948101">
-         </a>
-         8.Shell Meta Characters
-        </h2>
-       </div>
-      </div>
-     </div>
-     <p id="ch11Section_5_de">
-      Unix recognizes certain special characters, called "meta characters," as command directives. The shell meta characters are recognized anywhere they appear in the command line, even if they are not surrounded by blank space. For that reason, it is safest to only use the characters A-Z, a-z, 0-9, and the period, dash, and underscore characters when naming files and directories on Unix. If your file or directory has a shell meta character in the name, you will find it difficult to use the name in a shell command.
-     </p>
-     <p id="ch11Section_5_df">
-      The shell meta characters include:
-     </p>
-     <p id="ch11Section_5_e0">
-      / &lt; &gt; ! $ % ^ &amp; * | { } [ ] " ' ` ~ ;
-     </p>
-     <p id="ch11Section_5_e1">
-      Different shells may differ in the meta characters recognized.
-     </p>
-     <p id="ch11Section_5_e2">
-      As an example,
-     </p>
-     <pre class="programlisting">
-      $ ls file.*
-     </pre>
-     <p id="ch11Section_5_e3">
-      run on a directory containing the files file, file.c, file.lst, and myfile would list the files file.c and file.lst. However,:
-     </p>
-     <pre class="programlisting">
-      $ ls file.?
-     </pre>
-     <p id="ch11Section_5_e4">
-      run on the same directory would only list file.c because the ? only matches one character, no more, no less. This can save you a great deal of typing time. For example, if there is a file called california_cornish_hens_with_wild_rice and no other files whose names begin with 'c', you could view the file without typing the whole name by typing this:
-     </p>
-     <pre class="programlisting">
-      $ more c*
-     </pre>
-     <p id="ch11Section_5_e5">
-      because the c* matches that long file name.
-     </p>
-     <p id="ch11Section_5_e6">
-      Filenames containing metacharacters can pose many problems and should never be intentionally created. If you do find that you've created a file with metacharacters, and you would like to remove it, you have three options. You may use wildcards to match metacharacter, use the  to directly enter the filename, or put the command in double quotes (except in the case of double quotes within the file name, these must be captured with one of the first two methods). For example, deleting a file named "``*`|more"` can be accomplished with:
-     </p>
-     <pre class="programlisting">
-      $ rm ??more
-     </pre>
-     <p id="ch11Section_5_e7">
-      or:
-     </p>
-     <pre class="programlisting">
-      $ rm $\backslash$*$\backslash$|more
-     </pre>
-     <p id="ch11Section_5_e8">
-      or:
-     </p>
-     <pre class="programlisting">
-      $ rm ''*|more''
-     </pre>
-    </div>
-    <div class="section" title="9.Looking At Files">
-     <div class="titlepage">
-      <div>
-       <div>
-        <h2 class="title" style="clear: both">
-         <a name="id2948205">
-         </a>
-         9.Looking At Files
-        </h2>
-       </div>
-      </div>
-     </div>
-     <div class="section" title="9.1.cat">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2948213">
-          </a>
-          9.1.cat
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_e9">
-       The
-       <span class="emphasis">
-        <em>
-         cat
-        </em>
-       </span>
-       command is a standard Unix program used to concatenate and display files. The name is from "catenate", a synonym of
-       <span class="emphasis">
-        <em>
-         concatenate
-        </em>
-       </span>
-       .
-      </p>
-      <p id="ch11Section_5_ea">
-       The Single Unix Specification specifies the behavior that the contents of each of the files given in sequence as arguments will be written to the standard output in the same sequence, and mandates one option, -u, where each byte is printed as it is read.
-      </p>
-      <p id="ch11Section_5_eb">
-       If the filename is specified as -, then
-       <span class="emphasis">
-        <em>
-         cat
-        </em>
-       </span>
-       will read from standard input at that point in the sequence. If no files are specified,
-       <span class="emphasis">
-        <em>
-         cat
-        </em>
-       </span>
-       will read from standard input entered.
-      </p>
-      <div class="section" title="9.1.1.Jargon File Definition">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2948256">
-           </a>
-           9.1.1.Jargon File Definition
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_ec">
-        The Jargon File version 4.4.7 lists this as the definition of
-        <span class="emphasis">
-         <em>
-          cat
-         </em>
-        </span>
-        :
-       </p>
-       <pre class="programlisting">
-        1. To spew an entire file to the screen or some other output sink without
-     pause (syn. blast).
-
-2. By extension, to dump large amounts of data at an unprepared target or
-     with no intention of browsing it carefully. Usage: considered silly.
-     Rare outside Unix sites. See also dd, BLT.
-
-     Among Unix fans, *cat(1)* is considered an excellent example of
-     user-interface design, because it delivers the file contents without
-     such verbosity as spacing or headers between the files, and because
-     it does not require the files to consist of lines of text, but works
-     with any sort of data.
-
-     Among Unix critics, *cat(1)* is considered the canonical example of
-     bad user-interface design, because of its woefully unobvious name.
-     It is far more often used to blast a single file to standard output
-     than to concatenate two or more files. The name cat for the former
-     operation is just as unintuitive as, say, LISP's cdr.
-
-     Of such oppositions are holy wars made...
-       </pre>
-      </div>
-      <div class="section" title="9.1.2.Useless Use of 'cat'">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2948296">
-           </a>
-           9.1.2.Useless Use of 'cat'
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_ed">
-        UUOC (from comp.unix.shell on Usenet) stands for Useless Use of cat. As it is observed on
-        <span class="emphasis">
-         <em>
-          comp.unix.shell
-         </em>
-        </span>
-        , The purpose of cat is to concatenate (or 'catenate') files. If it's only one file, concatenating it with nothing at all is a waste of time, and costs you a process.
-       </p>
-       <p id="ch11Section_5_ee">
-        Nevertheless one sees people doing:
-       </p>
-       <pre class="programlisting">
-        $ cat file | some_command and its args ...
-       </pre>
-       <p id="ch11Section_5_ef">
-        instead of the equivalent and cheaper:
-       </p>
-       <pre class="programlisting">
-        &lt;file some_command and its args ...
-       </pre>
-       <p id="ch11Section_5_f0">
-        or (equivalently and more classically):
-       </p>
-       <pre class="programlisting">
-        some_command and its args ... &lt;file
-       </pre>
-       <p id="ch11Section_5_f1">
-        Since 1995, occasional awards for UUOC have been given out. The activity of fixing instances of UUOC is sometimes called 'demoggification'.
-       </p>
-       <p id="ch11Section_5_f2">
-        Amongst many, it is still considered safer to use
-        <span class="emphasis">
-         <em>
-          cat
-         </em>
-        </span>
-        for such cases given that the &lt; and &gt; keys are next to each other in many popular keyboard mappings. While the risk might be low, the impact of using &gt; instead of &lt; can be high and prohibitive.
-       </p>
-      </div>
-      <div class="section" title="9.1.3.zcat">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2948366">
-           </a>
-           9.1.3.zcat
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_f3">
-        <span class="emphasis">
-         <em>
-          zcat
-         </em>
-        </span>
-        is a Unix program similar to
-        <span class="emphasis">
-         <em>
-          cat
-         </em>
-        </span>
-        , that decompresses individual files and concatenates them to standard output. Traditionally
-        <span class="emphasis">
-         <em>
-          zcat
-         </em>
-        </span>
-        operated on files compressed by compress but today it is usually able to operate on
-        <span class="emphasis">
-         <em>
-          gzip
-         </em>
-        </span>
-        or even
-        <span class="emphasis">
-         <em>
-          bzip2
-         </em>
-        </span>
-        archives. On such systems, it is equivalent to
-        <span class="emphasis">
-         <em>
-          gunzip -c
-         </em>
-        </span>
-       </p>
-      </div>
-     </div>
-     <div class="section" title="9.2.more">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2948400">
-          </a>
-          9.2.more
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_f4">
-       In computing,
-       <span class="emphasis">
-        <em>
-         more
-        </em>
-       </span>
-       is a command to view (but not modify) the contents of a text file one screen at a time (terminal pager). It is available on Unix and Unix-like systems, DOS, OS/2 and Microsoft Windows. Programs of this sort are called pagers.
-      </p>
-      <div class="section" title="9.2.1.Usage">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2948419">
-           </a>
-           9.2.1.Usage
+           6.4.1.
+           <code class="literal">
+            for
+           </code>
+           loop
           </h4>
          </div>
         </div>
        </div>
-       <p id="ch11Section_5_f5">
-        The command-syntax is:
+       <p id="ch11Section_5_57">
+        Suppose we have a set of files, that have names beginning with numbers followed by their names -
+        <code class="literal">
+         08 - Society.mp3
+        </code>
+        . We would like to rename these files to remove the numbering. How would we go about doing that? It is clear from the problem statement that we could use a
+        <code class="literal">
+         for
+        </code>
+        loop, to loop through the list of files and rename each of the files.
+       </p>
+       <p id="ch11Section_5_58">
+        Let's first look at a simple
+        <code class="literal">
+         for
+        </code>
+        loop, to understand how it works.
+       </p>
+       <pre class="programlisting">
+        for animal in rat cat dog man
+do
+  echo $animal
+done
+       </pre>
+       <p id="ch11Section_5_59">
+        We just wrote a list of animals, each animal's name separated by a space and printed each name on a separate line. The variable
+        <code class="literal">
+         animal
+        </code>
+        is a dummy variable and has no significance. You could use something as lame as
+        <code class="literal">
+         i
+        </code>
+        in place of
+        <code class="literal">
+         animal
+        </code>
+        .
+       </p>
+       <p id="ch11Section_5_5a">
+        Now, we use a simple
+        <code class="literal">
+         for
+        </code>
+        loop to list the files that we are interested in.
        </p>
        <pre class="programlisting">
-        $ more [options] [file_name]
+        ls *.mp3 &gt; list
+for i in `cat list`
+do
+  echo "$i"
+done
        </pre>
-       <p id="ch11Section_5_f6">
-        If no file name is provided,
-        <span class="emphasis">
-         <em>
-          more
-         </em>
-        </span>
-        looks for input from stdin.
+       <p id="ch11Section_5_5b">
+        If your filenames contain spaces,
+        <code class="literal">
+         for
+        </code>
+        assumes each space separated word to be a single item in the list and prints it in a separate line. We could change the script slightly to overcome this problem.
+       </p>
+       <pre class="programlisting">
+        for i in *.mp3
+do
+  echo "$i"
+done
+       </pre>
+       <p id="ch11Section_5_5c">
+        Now, we have each file printed on a separate line. Depending on the files that we have we could use grep to get the relevant portion of the filenames and rename the files.
        </p>
-       <p id="ch11Section_5_f7">
-        Once
-        <span class="emphasis">
-         <em>
-          more
-         </em>
-        </span>
-        has obtained input, it displays as much as can fit on the current screen and waits for user input to advance, with the exception that a form feed (^L) will also cause
-        <span class="emphasis">
-         <em>
-          more
-         </em>
-        </span>
-        to wait at that line, regardless of the amount of text on the screen. In the lower-left corner of the screen is displayed the text "--More--" and a percentage, representing the percent of the file that
-        <span class="emphasis">
-         <em>
-          more
-         </em>
-        </span>
-        has paged through. (This percentage includes the text displayed on the current screen.) When
-        <span class="emphasis">
-         <em>
-          more
-         </em>
-        </span>
-        reaches the end of a file (100%) it exits. The most common methods of navigating through a file are
-        <span class="emphasis">
-         <em>
-          Enter
-         </em>
-        </span>
-        , which advances the output by one line, and
-        <span class="emphasis">
-         <em>
-          Space
-         </em>
-        </span>
-        , which advances the output by one screen.
+       <pre class="programlisting">
+        for i in *.mp3
+do
+  j=$(echo "$i"|grep -o "[A-Za-z'&amp;. ]*.mp3")
+  echo "$i -&gt; $j"
+done
+       </pre>
+       <p id="ch11Section_5_5d">
+        Now we just replace the echo command with a
+        <code class="literal">
+         mv
+        </code>
+        or a
+        <code class="literal">
+         cp
+        </code>
+        command.
        </p>
-       <p id="ch11Section_5_f8">
-        There are also other commands that can be used while navigating through the document; consult
-        <span class="emphasis">
-         <em>
-          more
-         </em>
-        </span>
-        's
-        <span class="emphasis">
-         <em>
-          man
-         </em>
-        </span>
-        page for more details.
-       </p>
-       <p id="ch11Section_5_f9">
-        <span class="emphasis">
-         <em>
-          Options
-         </em>
-        </span>
-        are typically entered before the file name, but can also be entered in the environment variable
-        <span class="emphasis">
-         <em>
-          $MORE
-         </em>
-        </span>
-        . Options entered in the actual command line will override those entered in the
-        <span class="emphasis">
-         <em>
-          $MORE
-         </em>
-        </span>
-        environment variable. Available options may vary between Unix systems.
+       <pre class="programlisting">
+        for i in *.mp3
+do
+  j=$(echo "$i"|grep -o "[A-Za-z'&amp;. ]*.mp3")
+  cp "$i" "$j"
+done
+       </pre>
+       <p id="ch11Section_5_5e">
+        As an exercise, you could try sorting the files in reverse alphabetical order and then prefix numbers to each of the filenames.
        </p>
       </div>
-     </div>
-     <div class="section" title="9.3.less">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2948510">
-          </a>
-          9.3.less
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_fa">
-       <span class="emphasis">
-        <em>
-         less
-        </em>
-       </span>
-       is a terminal pager program on Unix, Windows and Unix-like systems used to view (but not change) the contents of a text file one screen at a time. It is similar to
-       <span class="emphasis">
-        <em>
-         more
-        </em>
-       </span>
-       , but has the extended capability of allowing both forward and backward navigation through the file. Unlike most Unix text editors/viewers,
-       <span class="emphasis">
-        <em>
-         less
-        </em>
-       </span>
-       does not need to read the entire file before starting, resulting in faster load times with large files.
-      </p>
-      <div class="section" title="9.3.1.Usage">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2948538">
-           </a>
-           9.3.1.Usage
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_fb">
-        <span class="emphasis">
-         <em>
-          less
-         </em>
-        </span>
-        can be invoked with options to change its behaviour, for example, the number of lines to display on the screen. A few options vary depending on the operating system. While
-        <span class="emphasis">
-         <em>
-          less
-         </em>
-        </span>
-        is displaying the file, various commands can be used to navigate through the file. These commands are based on those used by both
-        <span class="emphasis">
-         <em>
-          more
-         </em>
-        </span>
-        and
-        <span class="emphasis">
-         <em>
-          vi
-         </em>
-        </span>
-        . It is also possible to search for character patterns in the file.
-       </p>
-       <p id="ch11Section_5_fc">
-        By default,
-        <span class="emphasis">
-         <em>
-          less
-         </em>
-        </span>
-        displays the contents of the file to the standard output (one screen at a time). If the file name argument is omitted, it displays the contents from standard input (usually the output of another command through a pipe). If the output is redirected to anything other than a terminal, for example a pipe to another command, less behaves like cat.
-       </p>
-       <p id="ch11Section_5_fd">
-        The command-syntax is:
-       </p>
-       <pre class="programlisting">
-        $ less [options] file_name
-       </pre>
-      </div>
-      <div class="section" title="9.3.2.Frequently Used Options">
+      <div class="section" title="6.4.2.while">
        <div class="titlepage">
         <div>
          <div>
           <h4 class="title">
-           <a name="id2948592">
+           <a name="id2857633">
            </a>
-           9.3.2.Frequently Used Options
+           6.4.2.
+           <code class="literal">
+            while
+           </code>
           </h4>
          </div>
         </div>
        </div>
-       <div class="itemizedlist">
-        <ul class="itemizedlist" type="*">
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_fe">
-           -g: Highlights just the current match of any searched string.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_ff">
-           -I: Case-insensitive searches.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_100">
-           -M: Shows more detailed prompt, including file position.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_101">
-           -N: Shows line numbers (useful for source code viewing).
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_102">
-           -S: Disables line wrap ("chop long lines"). Long lines can be seen by side scrolling.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_103">
-           -?: Shows help.
-          </p>
-         </li>
-        </ul>
-       </div>
+       <p id="ch11Section_5_5f">
+        The
+        <code class="literal">
+         while
+        </code>
+        command allows us to continuously execute a block of commands until the command that is controlling the loop is executing successfully.
+       </p>
+       <p id="ch11Section_5_60">
+        Let's start with the lamest example of a while loop.
+       </p>
+       <pre class="programlisting">
+        while true
+do
+  echo "True"
+done
+       </pre>
+       <p id="ch11Section_5_61">
+        This, as you can see, is an infinite loop that prints the
+        <code class="literal">
+         True
+        </code>
+        .
+       </p>
+       <p id="ch11Section_5_62">
+        Say we wish to write a simple program that takes user input and prints it back, until the input is
+        <code class="literal">
+         quit
+        </code>
+        , which quits the program.
+       </p>
+       <pre class="programlisting">
+        while [ "$variable" != "quit" ]
+do
+  read variable
+  echo "Input - $variable"
+done
+exit 0
+       </pre>
       </div>
-      <div class="section" title="9.3.3.Frequently Used Commands">
+      <div class="section" title="6.4.3.until">
        <div class="titlepage">
         <div>
          <div>
           <h4 class="title">
-           <a name="id2948644">
+           <a name="id2857683">
            </a>
-           9.3.3.Frequently Used Commands
+           6.4.3.
+           <code class="literal">
+            until
+           </code>
           </h4>
          </div>
         </div>
        </div>
-       <div class="itemizedlist">
-        <ul class="itemizedlist" type="*">
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_104">
-           [Arrows]/[Page Up]/[Page Down]/[Home]/[End]: Navigation.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_105">
-           [Space bar]: Next page.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_106">
-           b: Previous page.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_107">
-           ng: Jump to line number n. Default is the start of the file.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_108">
-           nG: Jump to line number n. Default is the end of the file.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_109">
-           /pattern: Search for pattern. Regular expressions can be used.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_10a">
-           '^ or g: Go to start of file.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_10b">
-           '$ or G: Go to end of file.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_10c">
-           s: Save current content (got from another program like grep) in a file.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_10d">
-           =: File information.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_10e">
-           h: Help.
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_10f">
-           q: Quit.
-          </p>
-         </li>
-        </ul>
-       </div>
-      </div>
-      <div class="section" title="9.3.4.Examples">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2948732">
-           </a>
-           9.3.4.Examples
-          </h4>
-         </div>
-        </div>
-       </div>
+       <p id="ch11Section_5_63">
+        The
+        <code class="literal">
+         until
+        </code>
+        loop is similar to the
+        <code class="literal">
+         while
+        </code>
+        loop, except that it executes until the conditional command does not execute properly.
+       </p>
+       <p id="ch11Section_5_64">
+        The infinite loop changes to the following, when
+        <code class="literal">
+         until
+        </code>
+        is used.
+       </p>
+       <pre class="programlisting">
+        until false
+do
+  echo "True"
+done
+       </pre>
+       <p id="ch11Section_5_65">
+        Now lets try and use these above mentioned options provided by shell to write a utility. Until now, when we try find or locate it looks through directories and files for result. But they wont search through tar archives and zipped files. Lets create a shell script for especially looking through these files
+       </p>
        <pre class="programlisting">
-        $ less -M readme.txt                     #Read "readme.txt."
-$ less +F /var/log/mail.log              #Follow mode for log
-$ file * | less                          #Easier file analysis.
-$ grep -i void *.c | less -I -p void     #Case insensitive search                                                         for "void" in all .c files
+        #!/bin/sh
+
+#To check number of arguments being passed.
+if [ $# -eq 0 ] ; then
+echo "Correct usage: $0 tar-archive filename  nOr $0 filename"
+exit 1
+else
+  if [ $# -eq 1 ] ; then
+    tar_archive=`find $PWD -name "*.tar*"`
+  else
+    tar_archive=`find $PWD -name $1`
+  fi
+fi
+
+#Search of particular file inside archives.
+for archive in $tar_archive
+do
+  echo $archive
+  variable=`tar -tf $archive`
+  for word in $variable
+  do
+    if [ $# -eq 1 ] ; then
+      echo "$word" | grep -q ".*$1"
+    else
+      echo "$word" | grep -q ".*$2"
+    fi
+  if [ $? -eq 0 ] ; then
+    echo "File present in $archive!"
+  fi
+  done
+done
        </pre>
       </div>
      </div>
-    </div>
-    <div class="section" title="10.Directory Structure">
-     <div class="titlepage">
-      <div>
-       <div>
-        <h2 class="title" style="clear: both">
-         <a name="id2948748">
-         </a>
-         10.Directory Structure
-        </h2>
-       </div>
-      </div>
-     </div>
-     <p id="ch11Section_5_110">
-      In the File Hierarchy Standard (FHS) all files and directories appear under the root directory "/", even if they are stored on different physical devices. Note however that some of these directories may or may not be present on a Unix system depending on whether certain subsystems, such as the X Window System, are installed.
-     </p>
-     <p id="ch11Section_5_111">
-      The majority of these directories exist in all UNIX operating systems and are generally used in much the same way; however, the descriptions here are those used specifically for the FHS, and are not considered authoritative for platforms other than Linux.
-     </p>
-     <table summary="Directory Structure" border="1">
-      <colgroup>
-       <col width="15">
-       </col>
-       <col width="48">
-       </col>
-      </colgroup>
-     </table>
-     <div class="section" title="10.1.man hier">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2949017">
-          </a>
-          10.1.man hier
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_136">
-       This is the manual page on the UNIX filesystem. The syntax for this is:
-      </p>
-      <pre class="programlisting">
-       $ man hier
-      </pre>
-     </div>
-     <div class="section" title="10.2.ls -l">
+     <div class="section" title="6.5.Functions">
       <div class="titlepage">
        <div>
         <div>
          <h3 class="title">
-          <a name="id2949033">
-          </a>
-          10.2.ls -l
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_137">
-       Shows you huge amounts of information (permissions, owners, size, and when last modified) for folders and files. The syntax is
-      </p>
-      <pre class="programlisting">
-       $ ls -l
-      </pre>
-      <p id="ch11Section_5_138">
-       This can be done after entering the required directory.
-      </p>
-     </div>
-    </div>
-    <div class="section" title="11.Permissions and Ownership">
-     <div class="titlepage">
-      <div>
-       <div>
-        <h2 class="title" style="clear: both">
-         <a name="id2949056">
-         </a>
-         11.Permissions and Ownership
-        </h2>
-       </div>
-      </div>
-     </div>
-     <div class="section" title="11.1.chmod">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2949065">
+          <a name="id2857738">
           </a>
-          11.1.chmod
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_139">
-       The
-       <span class="emphasis">
-        <em>
-         chmod
-        </em>
-       </span>
-       command (abbreviated from 'change mode') is a shell command and C language function in Unix and Unix-like environments. When executed, it can change file system modes of files and directories. The modes include permissions and special modes.A chmod command first appeared in AT&amp;T Unix version 1, and is still used today on Unix-like machines.
-      </p>
-      <div class="section" title="11.1.1.Usage">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2949091">
-           </a>
-           11.1.1.Usage
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_13a">
-        The
-        <span class="emphasis">
-         <em>
-          chmod
-         </em>
-        </span>
-        command options are specified like this:
-       </p>
-       <pre class="programlisting">
-        $ chmod [options] mode[,mode] file1 [file2 ...]
-       </pre>
-       <p id="ch11Section_5_13b">
-        To view what the permissions currently are, type:
-       </p>
-       <pre class="programlisting">
-        $ ls -l file
-       </pre>
-      </div>
-      <div class="section" title="11.1.2.Command line options">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2949118">
-           </a>
-           11.1.2.Command line options
-          </h4>
-         </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_13c">
-        The
-        <span class="emphasis">
-         <em>
-          chmod
-         </em>
-        </span>
-        command has a number of command line options that affect its behavior. The most common options are:
-       </p>
-       <div class="itemizedlist">
-        <ul class="itemizedlist" type="*">
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_13d">
-           -R: Changes the modes of directories and files recursively
-          </p>
-         </li>
-         <li class="listitem" style="list-style-type: *">
-          <p id="ch11Section_5_13e">
-           -v: Verbose mode; lists all files as they are being processed
-          </p>
-         </li>
-        </ul>
-       </div>
-       <div class="section" title="11.1.2.1.Symbolic modes">
-        <div class="titlepage">
-         <div>
-          <div>
-           <h5 class="title">
-            <a name="id2949154">
-            </a>
-            11.1.2.1.Symbolic modes
-           </h5>
-          </div>
-         </div>
-        </div>
-        <p id="ch11Section_5_13f">
-         To the
-         <span class="emphasis">
-          <em>
-           chmod
-          </em>
-         </span>
-         utility, all permissions and special modes are represented by its mode parameter. One way to adjust the mode of files or directories is to specify a symbolic mode. The symbolic mode is composed of three components, which are combined to form a single string of text:
-        </p>
-        <pre class="programlisting">
-         $ chmod [references][operator][modes] file1 ...
-        </pre>
-        <p id="ch11Section_5_140">
-         The references (or classes) are used to distinguish the users to whom the permissions apply. If no references are specified it defaults to all but modifies only the permissions allowed by the umask. The references are represented by one or more of the following letters:
-        </p>
-        <table summary="Symbolic modes" border="1">
-         <colgroup>
-          <col width="14">
-          </col>
-          <col width="8">
-          </col>
-          <col width="45">
-          </col>
-         </colgroup>
-        </table>
-        <p id="ch11Section_5_150">
-         The
-         <span class="emphasis">
-          <em>
-           chmod
-          </em>
-         </span>
-         program uses an operator to specify how the modes of a file should be adjusted. The following operators are accepted:
-        </p>
-        <table summary="Symbolic modes" border="1">
-         <colgroup>
-          <col width="14">
-          </col>
-          <col width="54">
-          </col>
-         </colgroup>
-        </table>
-        <p id="ch11Section_5_157">
-         The modes indicate which permissions are to be granted or taken away from the specified classes. There are three basic modes which correspond to the basic permissions:
-        </p>
-        <table summary="Symbolic modes" border="1">
-         <colgroup>
-          <col width="5">
-          </col>
-          <col width="14">
-          </col>
-          <col width="48">
-          </col>
-         </colgroup>
-        </table>
-        <p id="ch11Section_5_16d">
-         The combination of these three components produces a string that is understood by the chmod command. Multiple changes can be specified by separating multiple symbolic modes with commas.
-        </p>
-       </div>
-       <div class="section" title="11.1.2.2.Symbolic examples">
-        <div class="titlepage">
-         <div>
-          <div>
-           <h5 class="title">
-            <a name="id2949700">
-            </a>
-            11.1.2.2.Symbolic examples
-           </h5>
-          </div>
-         </div>
-        </div>
-        <p id="ch11Section_5_16e">
-         Add the 'read' and 'write' permissions to the 'user' and 'group' classes of a directory:
-        </p>
-        <pre class="programlisting">
-         $ chmod ug+rw mydir
-$ ls -ld mydir
-drw-rw----   2 starwars  yoda  96 Dec 8 12:53 mydir
-        </pre>
-        <p id="ch11Section_5_16f">
-         For a file, remove
-         <span class="emphasis">
-          <em>
-           write
-          </em>
-         </span>
-         permissions for all classes:
-        </p>
-        <pre class="programlisting">
-         $ chmod a-w myfile
-$ ls -l myfile
--r-xr-xr-x   2 starwars  yoda 96 Dec 8 12:53 myfile
-        </pre>
-        <p id="ch11Section_5_170">
-         Set the permissions for the
-         <span class="emphasis">
-          <em>
-           u*ser and the *g*roup to read and execute only (no write permission) on *mydir
-          </em>
-         </span>
-         .
-        </p>
-        <pre class="programlisting">
-         $ chmod ug=rx mydir
-$ ls -ld mydir
-dr-xr-x---   2 starwars  yoda 96 Dec 8 12:53 mydir
-        </pre>
-       </div>
-       <div class="section" title="11.1.2.3.Octal numbers">
-        <div class="titlepage">
-         <div>
-          <div>
-           <h5 class="title">
-            <a name="id2949741">
-            </a>
-            11.1.2.3.Octal numbers
-           </h5>
-          </div>
-         </div>
-        </div>
-        <p id="ch11Section_5_171">
-         The
-         <span class="emphasis">
-          <em>
-           chmod
-          </em>
-         </span>
-         command also accepts three and four-digit octal numbers representing modes. Using a three-digit octal number to set the modes of a file named myfile :
-        </p>
-        <pre class="programlisting">
-         $ chmod 664 myfile
-$ ls -l myfile
--rw-rw-r--  1   57 Jul  3 10:13  myfile
-        </pre>
-        <p id="ch11Section_5_172">
-         Since the
-         <span class="emphasis">
-          <em>
-           setuid
-          </em>
-         </span>
-         ,
-         <span class="emphasis">
-          <em>
-           setgid
-          </em>
-         </span>
-         and
-         <span class="emphasis">
-          <em>
-           sticky
-          </em>
-         </span>
-         bits are not set, this is equivalent to:
-        </p>
-        <pre class="programlisting">
-         $ chmod 0664 myfile
-        </pre>
-       </div>
-       <div class="section" title="11.1.2.4.Special modes">
-        <div class="titlepage">
-         <div>
-          <div>
-           <h5 class="title">
-            <a name="id2949782">
-            </a>
-            11.1.2.4.Special modes
-           </h5>
-          </div>
-         </div>
-        </div>
-        <p id="ch11Section_5_173">
-         The
-         <span class="emphasis">
-          <em>
-           chmod
-          </em>
-         </span>
-         command is also capable of changing the additional permissions or special modes of a file or directory. The symbolic modes use
-         <span class="strong">
-          <strong>
-           s
-          </strong>
-         </span>
-         to represent the
-         <span class="emphasis">
-          <em>
-           setuid
-          </em>
-         </span>
-         and
-         <span class="emphasis">
-          <em>
-           setgid
-          </em>
-         </span>
-         modes, and
-         <span class="strong">
-          <strong>
-           t
-          </strong>
-         </span>
-         to represent the sticky mode. The modes are only applied to the appropriate classes, regardless of whether or not other classes are specified.
-        </p>
-        <p id="ch11Section_5_174">
-         Most operating systems support the specification of special modes using octal modes, but some do not. On these systems, only the symbolic modes can be used.
-        </p>
-       </div>
-      </div>
-     </div>
-    </div>
-    <div class="section" title="12.Redirection and Piping">
-     <div class="titlepage">
-      <div>
-       <div>
-        <h2 class="title" style="clear: both">
-         <a name="id2949829">
-         </a>
-         12.Redirection and Piping
-        </h2>
-       </div>
-      </div>
-     </div>
-     <p id="ch11Section_5_175">
-      In computing,
-      <span class="emphasis">
-       <em>
-        redirection
-       </em>
-      </span>
-      is a function common to most command-line interpreters, including the various Unix shells that can redirect standard streams to user-specified locations.
-     </p>
-     <p id="ch11Section_5_176">
-      Programs do redirection with the
-      <span class="emphasis">
-       <em>
-        dup2(2)
-       </em>
-      </span>
-      system call, or its less-flexible but higher-level stdio analogues,
-      <span class="emphasis">
-       <em>
-        freopen(3)
-       </em>
-      </span>
-      and
-      <span class="emphasis">
-       <em>
-        popen(3)
-       </em>
-      </span>
-      .
-     </p>
-     <div class="section" title="12.1.Redirecting standard input and standard output">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2949866">
-          </a>
-          12.1.Redirecting standard input and standard output
+          6.5.Functions
          </h3>
         </div>
        </div>
       </div>
-      <p id="ch11Section_5_177">
-       Redirection is usually implemented by placing certain characters between commands. Typically, the syntax of these characters is as follows:
+      <p id="ch11Section_5_66">
+       When a group of commands are repeatedly being used within a script, it is convenient to group them as a function. This saves a lot of time and you can avoid retyping the code again and again. Also, it will help you maintain your code easily. Let's see how we can define a simple function,
+       <code class="literal">
+        hello-world
+       </code>
+       . Functions can be defined in bash, either using the
+       <code class="literal">
+        function
+       </code>
+       built-in followed by the function name or just the function name followed by a pair of parentheses.
       </p>
       <pre class="programlisting">
-       $ command1 &gt; file1
+       function hello-world
+{
+echo "Hello, World.";
+}
+
+hello-world () {
+  echo "Hello, World.";
+}
+
+$ hello-world
+Hello, World.
       </pre>
-      <p id="ch11Section_5_178">
-       executes
-       <span class="emphasis">
-        <em>
-         command1
-        </em>
-       </span>
-       , placing the output in file1. Note that this will truncate any existing data in
-       <span class="emphasis">
-        <em>
-         file1
-        </em>
-       </span>
-       . To append output to the end of the file, use the &gt;&gt; operator.:
-      </p>
-      <pre class="programlisting">
-       $ command1 &lt; file1
-      </pre>
-      <p id="ch11Section_5_179">
-       executes
-       <span class="emphasis">
-        <em>
-         command1
-        </em>
-       </span>
-       , using
-       <span class="emphasis">
-        <em>
-         file1
-        </em>
-       </span>
-       as the source of input (as opposed to the keyboard).:
+      <p id="ch11Section_5_67">
+       Passing parameters to functions is similar to passing them to scripts.
       </p>
       <pre class="programlisting">
-       $ command1 &lt; infile &gt; outfile
+       function hello-name
+{
+echo "Hello, $1.";
+}
+
+$ hello-name 9
+Hello, 9.
       </pre>
-      <p id="ch11Section_5_17a">
-       combines the two capabilities:
-       <span class="emphasis">
-        <em>
-         command1
-        </em>
-       </span>
-       reads from
-       <span class="emphasis">
-        <em>
-         infile
-        </em>
-       </span>
-       and writes to
-       <span class="emphasis">
-        <em>
-         outfile
-        </em>
-       </span>
+      <p id="ch11Section_5_68">
+       Any variables that you define within a function, will be added to the global namespace. If you wish to define variables that are restricted to the scope of the function, define a variable using the
+       <code class="literal">
+        local
+       </code>
+       built-in command of bash.
       </p>
-     </div>
-     <div class="section" title="12.2.Piping">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2949936">
-          </a>
-          12.2.Piping
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_17b">
-       Programs can be run together such that one program reads the output from another with no need for an explicit intermediate file:
-A pipeline of three programs run on a text terminal:
+      <p id="ch11Section_5_69">
+       We shall now write a function for the word frequency generating script that we had looked at in the previous session.
       </p>
       <pre class="programlisting">
-       $ command1 | command2
+       function word_frequency {
+  if [ $# -ne 1 ]
+  then
+    echo "Usage: $0 file_name"
+    exit 1
+  else
+    if [ -f "$1" ]
+    then
+      grep  "[A-Za-z]*" -o "$1" | tr 'A-Z' 'a-z' | sort | uniq -c | sort -nr | less
+    fi
+  fi
+}
       </pre>
-      <p id="ch11Section_5_17c">
-       executes
-       <span class="emphasis">
-        <em>
-         command1
-        </em>
-       </span>
-       , using its output as the input for
-       <span class="emphasis">
-        <em>
-         command2
-        </em>
-       </span>
-       (commonly called piping, since the "|" character is known as a "pipe").
-      </p>
-      <p id="ch11Section_5_17d">
-       This is equivalent to using two redirects and a temporary file:
-      </p>
-      <pre class="programlisting">
-       $ command1 &gt; tempfile
-$ command2 &lt; tempfile
-$ rm tempfile
-      </pre>
-      <p id="ch11Section_5_17e">
-       A good example for command piping is combining
-       <span class="emphasis">
-        <em>
-         echo
-        </em>
-       </span>
-       with another command to achieve something interactive in a non-interactive shell, e.g.:
-      </p>
-      <pre class="programlisting">
-       $ echo -e "user\npass" | ftp localhost
-      </pre>
-      <p id="ch11Section_5_17f">
-       This runs the ftp client with input user, press return, then pass.
+      <p id="ch11Section_5_6a">
+       As an exercise, modify the function to accept the input for the number of top frequency words to be shown (if none is given, assume 10).
       </p>
      </div>
-     <div class="section" title="12.3.Redirecting to and from the standard file handles">
+     <div class="section" title="6.6.Further Reading:">
       <div class="titlepage">
        <div>
         <div>
          <h3 class="title">
-          <a name="id2949997">
+          <a name="id2857809">
           </a>
-          12.3.Redirecting to and from the standard file handles
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_180">
-       In Unix shells derived from the original Bourne shell, the first two actions can be further modified by placing a number (the file descriptor) immediately before the character; this will affect which stream is used for the redirection. The Unix standard I/O streams are:
-      </p>
-      <table summary="Redirecting to and from the standard file handles" border="1">
-       <colgroup>
-        <col width="12">
-        </col>
-        <col width="13">
-        </col>
-        <col width="24">
-        </col>
-       </colgroup>
-      </table>
-      <p id="ch11Section_5_18d">
-       For example:
-      </p>
-      <pre class="programlisting">
-       $ command1 2&gt; file1
-      </pre>
-      <p id="ch11Section_5_18e">
-       executes
-       <span class="emphasis">
-        <em>
-         command1
-        </em>
-       </span>
-       , directing the standard error stream to
-       <span class="emphasis">
-        <em>
-         file1
-        </em>
-       </span>
-       .
-      </p>
-      <p id="ch11Section_5_18f">
-       In shells derived from
-       <span class="emphasis">
-        <em>
-         csh
-        </em>
-       </span>
-       (the C shell), the syntax instead appends the &amp; character to the redirect characters, thus achieving a similar result.
-      </p>
-      <p id="ch11Section_5_190">
-       Another useful capability is to redirect one standard file handle to another. The most popular variation is to merge standard error into standard output so error messages can be processed together with (or alternately to) the usual output. Example:
-      </p>
-      <pre class="programlisting">
-       $ find / -name .profile &gt; results 2&gt;&amp;1
-      </pre>
-      <p id="ch11Section_5_191">
-       will try to find all files named
-       <span class="emphasis">
-        <em>
-         .profile
-        </em>
-       </span>
-       . Executed without redirection, it will output hits to
-       <span class="emphasis">
-        <em>
-         stdout
-        </em>
-       </span>
-       and errors (e.g. for lack of privilege to traverse protected directories) to
-       <span class="emphasis">
-        <em>
-         stderr
-        </em>
-       </span>
-       . If standard output is directed to file results, error messages appear on the console. To see both hits and error messages in file results, merge
-       <span class="emphasis">
-        <em>
-         stderr
-        </em>
-       </span>
-       (handle 2) into
-       <span class="emphasis">
-        <em>
-         stdout
-        </em>
-       </span>
-       (handle 1) using 2&gt;&amp;1 .
-      </p>
-      <p id="ch11Section_5_192">
-       It's possible use 2&gt;&amp;1 before "&gt;" but it doesn't work. In fact, when the interpreter reads 2&gt;&amp;1, it doesn't know yet where standard output is redirected and then standard error isn't merged.
-      </p>
-      <p id="ch11Section_5_193">
-       If the merged output is to be piped into another program, the file merge sequence 2&gt;&amp;1 must precede the pipe symbol, thus:
-      </p>
-      <pre class="programlisting">
-       $ find / -name .profile 2&gt;&amp;1 | less
-      </pre>
-      <p id="ch11Section_5_194">
-       A simplified form of the command:
-      </p>
-      <pre class="programlisting">
-       $ command &gt; file 2&gt;&amp;1
-      </pre>
-      <p id="ch11Section_5_195">
-       is:
-      </p>
-      <pre class="programlisting">
-       $ command &amp;&gt;file
-      </pre>
-      <p id="ch11Section_5_196">
-       or:
-      </p>
-      <pre class="programlisting">
-       $command &gt;&amp;file
-      </pre>
-     </div>
-     <div class="section" title="12.4.Chained pipelines">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2950201">
-          </a>
-          12.4.Chained pipelines
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_197">
-       The redirection and piping tokens can be chained together to create complex commands. For example:
-      </p>
-      <pre class="programlisting">
-       $ ls | grep '\.sh' | sort &gt; shlist
-      </pre>
-      <p id="ch11Section_5_198">
-       lists the contents of the current directory, where this output is filtered to only contain lines which contain
-       <span class="emphasis">
-        <em>
-         .sh
-        </em>
-       </span>
-       , sort this resultant output lexicographically, and place the final output in
-       <span class="emphasis">
-        <em>
-         shlist
-        </em>
-       </span>
-       . This type of construction is used very commonly in shell scripts and batch files.
-      </p>
-     </div>
-     <div class="section" title="12.5.Redirect to multiple outputs">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2950235">
-          </a>
-          12.5.Redirect to multiple outputs
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_199">
-       The standard command
-       <span class="emphasis">
-        <em>
-         tee
-        </em>
-       </span>
-       can redirect output from a command to several destinations.
-      </p>
-      <pre class="programlisting">
-       $ ls -lrt | tee xyz
-      </pre>
-      <p id="ch11Section_5_19a">
-       This directs the file list output to both standard output as well as to the file
-       <span class="emphasis">
-        <em>
-         xyz
-        </em>
-       </span>
-       .
-      </p>
-     </div>
-    </div>
-    <div class="section" title="13.More Text Processing">
-     <div class="titlepage">
-      <div>
-       <div>
-        <h2 class="title" style="clear: both">
-         <a name="id2950266">
-         </a>
-         13.More Text Processing
-        </h2>
-       </div>
-      </div>
-     </div>
-     <div class="section" title="13.1.grep">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2950274">
-          </a>
-          13.1.grep
+          6.6.Further Reading:
          </h3>
         </div>
        </div>
       </div>
-      <p id="ch11Section_5_19b">
-       <span class="emphasis">
-        <em>
-         grep
-        </em>
-       </span>
-       is a command line text search utility originally written for Unix. The name is taken from the first letters in
-       <span class="emphasis">
-        <em>
-         global / regular expression / print
-        </em>
-       </span>
-       , a series of instructions for the
-       <span class="emphasis">
-        <em>
-         ed
-        </em>
-       </span>
-       text editor. The
-       <span class="emphasis">
-        <em>
-         grep
-        </em>
-       </span>
-       command searches files or standard input globally for lines matching a given regular expression, and prints them to the program's standard output.
-      </p>
-      <div class="section" title="13.1.1.Usage">
-       <div class="titlepage">
-        <div>
-         <div>
-          <h4 class="title">
-           <a name="id2950305">
-           </a>
-           13.1.1.Usage
-          </h4>
+      <div class="itemizedlist">
+       <ul class="itemizedlist" type="*">
+        <li class="listitem" style="list-style-type: *">
+         <p id="ch11Section_5_6b">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://www.freeos.com/guides/lsst/
+         </div>
+        </li>
+        <li class="listitem" style="list-style-type: *">
+         <p id="ch11Section_5_6c">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://bash.cyberciti.biz/guide/Main_Page
          </div>
-        </div>
-       </div>
-       <p id="ch11Section_5_19c">
-        This is an example of a common
-        <span class="emphasis">
-         <em>
-          grep
-         </em>
-        </span>
-        usage:
-       </p>
-       <pre class="programlisting">
-        $ grep apple fruitlist.txt
-       </pre>
-       <p id="ch11Section_5_19d">
-        In this case,
-        <span class="emphasis">
-         <em>
-          grep
-         </em>
-        </span>
-        prints all lines containing 'apple' from the file
-        <span class="emphasis">
-         <em>
-          fruitlist.txt
-         </em>
-        </span>
-        , regardless of word boundaries; therefore lines containing 'pineapple' or 'apples' are also printed. The
-        <span class="emphasis">
-         <em>
-          grep
-         </em>
-        </span>
-        command is case sensitive by default, so this example's output does not include lines containing 'Apple' (with a capital A) unless they also contain 'apple'.
-       </p>
-       <p id="ch11Section_5_19e">
-        Like most Unix commands,
-        <span class="emphasis">
-         <em>
-          grep
-         </em>
-        </span>
-        accepts command line arguments to change this and many other behaviors. For example:
-       </p>
-       <pre class="programlisting">
-        $ grep -i apple fruitlist.txt
-       </pre>
-       <p id="ch11Section_5_19f">
-        This prints all lines containing 'apple' regardless of capitalization. The '-i' argument tells
-        <span class="emphasis">
-         <em>
-          grep
-         </em>
-        </span>
-        to be case insensitive, or to ignore case.
-       </p>
-       <p id="ch11Section_5_1a0">
-        To print all lines containing 'apple' as a word ('pineapple' and 'apples' will not match):
-       </p>
-       <pre class="programlisting">
-        $ grep -w apple fruitlist.txt
-       </pre>
-       <p id="ch11Section_5_1a1">
-        Regular expressions can be used to match more complicated queries.
-       </p>
-       <div class="section" title="13.1.1.1.Variations">
-        <div class="titlepage">
-         <div>
-          <div>
-           <h5 class="title">
-            <a name="id2950384">
-            </a>
-            13.1.1.1.Variations
-           </h5>
+        </li>
+        <li class="listitem" style="list-style-type: *">
+         <p id="ch11Section_5_6d">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
           </div>
+          http://tldp.org/LDP/abs/html/
          </div>
-        </div>
-        <p id="ch11Section_5_1a2">
-         There are countless implementations and derivatives of
-         <span class="emphasis">
-          <em>
-           grep
-          </em>
-         </span>
-         available for many operating systems. Early variants of
-         <span class="emphasis">
-          <em>
-           grep
-          </em>
-         </span>
-         included
-         <span class="emphasis">
-          <em>
-           egrep
-          </em>
-         </span>
-         and
-         <span class="emphasis">
-          <em>
-           fgrep
-          </em>
-         </span>
-         . The former applies an extended regular expression syntax that was added to Unix after Ken Thompson's original regular expression implementation. The latter searches for any of a list of 'fixed' strings using the Aho-Corasick algorithm. These variants are embodied in most modern
-         <span class="emphasis">
-          <em>
-           grep
-          </em>
-         </span>
-         implementations as command-line switches (and standardized as -E and -F in POSIX). In such combined implementations,
-         <span class="emphasis">
-          <em>
-           grep
-          </em>
-         </span>
-         may also behave differently depending on the name by which it is invoked, allowing
-         <span class="emphasis">
-          <em>
-           fgrep
-          </em>
-         </span>
-         ,
-         <span class="emphasis">
-          <em>
-           egrep
-          </em>
-         </span>
-         , and
-         <span class="emphasis">
-          <em>
-           grep
-          </em>
-         </span>
-         to be links to the same program.
-        </p>
-        <p id="ch11Section_5_1a3">
-         <span class="emphasis">
-          <em>
-           pcregrep
-          </em>
-         </span>
-         is an implementation of
-         <span class="emphasis">
-          <em>
-           grep
-          </em>
-         </span>
-         that uses Perl regular expression syntax.
-        </p>
-        <p id="ch11Section_5_1a4">
-         Other commands contain the word 'grep' to indicate that they search (usually for regular expression matches). The
-         <span class="emphasis">
-          <em>
-           pgrep
-          </em>
-         </span>
-         utility, for instance, displays the processes whose names match a given regular expression.
-        </p>
-       </div>
+        </li>
+        <li class="listitem" style="list-style-type: *">
+         <p id="ch11Section_5_6e">
+         </p>
+         <div class="reference">
+          <div class="titlepage">
+           <hr />
+          </div>
+          http://tldp.org/LDP/Bash-Beginners-Guide/html/Bash-Beginners-Guide.html
+         </div>
+        </li>
+       </ul>
       </div>
      </div>
-     <div class="section" title="13.2.tr">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2950463">
-          </a>
-          13.2.tr
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_1a5">
-       <span class="emphasis">
-        <em>
-         tr
-        </em>
-       </span>
-       (abbreviated from
-       <span class="emphasis">
-        <em>
-         translate
-        </em>
-       </span>
-       or
-       <span class="emphasis">
-        <em>
-         transliterate
-        </em>
-       </span>
-       ) is a command in Unix-like operating systems.
-      </p>
-      <p id="ch11Section_5_1a6">
-       When executed, the program reads from the standard input and writes to the standard output. It takes as parameters two sets of characters, and replaces occurrences of the characters in the first set with the corresponding elements from the other set. For example,
-      </p>
-      <pre class="programlisting">
-       $ tr 'abcd' 'jkmn'
-      </pre>
-      <p id="ch11Section_5_1a7">
-       maps 'a' to 'j', 'b' to 'k', 'c' to 'm', and 'd' to 'n'.
-      </p>
-      <p id="ch11Section_5_1a8">
-       Sets of characters may be abbreviated by using character ranges. The previous example could be written:
-      </p>
-      <pre class="programlisting">
-       $ tr 'a-d' 'jkmn'
-      </pre>
-      <p id="ch11Section_5_1a9">
-       In POSIX compliant versions of
-       <span class="emphasis">
-        <em>
-         tr
-        </em>
-       </span>
-       the set represented by a character range depends on the locale's collating order, so it is safer to avoid character ranges in scripts that might be executed in a locale different from that in which they were written. Ranges can often be replaced with POSIX character sets such as [:alpha:].
-      </p>
-      <p id="ch11Section_5_1aa">
-       The
-       <span class="emphasis">
-        <em>
-         -c
-        </em>
-       </span>
-       flag complements the first set of characters.
-      </p>
-      <pre class="programlisting">
-       $ tr -cd '[:alnum:]'
-      </pre>
-      <p id="ch11Section_5_1ab">
-       therefore removes all non-alphanumeric characters.
-      </p>
-      <p id="ch11Section_5_1ac">
-       The
-       <span class="emphasis">
-        <em>
-         -s
-        </em>
-       </span>
-       flag causes tr to compress sequences of identical adjacent characters in its output to a single token. For example,
-      </p>
-      <pre class="programlisting">
-       $ tr -s '\n' '\n'
-      </pre>
-      <p id="ch11Section_5_1ad">
-       replaces sequences of one or more newline characters with a single newline.
-      </p>
-      <p id="ch11Section_5_1ae">
-       The
-       <span class="emphasis">
-        <em>
-         -d
-        </em>
-       </span>
-       flag causes tr to delete all tokens of the specified set of characters from its input. In this case, only a single character set argument is used. The following command removes carriage return characters, thereby converting a file in DOS/Windows format to one in Unix format.
-      </p>
-      <pre class="programlisting">
-       $ tr -d '\r'
-      </pre>
-      <p id="ch11Section_5_1af">
-       Most versions of
-       <span class="emphasis">
-        <em>
-         tr
-        </em>
-       </span>
-       , including GNU
-       <span class="emphasis">
-        <em>
-         tr
-        </em>
-       </span>
-       and classic Unix
-       <span class="emphasis">
-        <em>
-         tr
-        </em>
-       </span>
-       , operate on single byte characters and are not Unicode compliant. An exception is the Heirloom Toolchest implementation, which provides basic Unicode support.
-      </p>
-      <p id="ch11Section_5_1b0">
-       Ruby and Perl also have an internal
-       <span class="emphasis">
-        <em>
-         tr
-        </em>
-       </span>
-       operator, which operates analogously. Tcl's
-       <span class="emphasis">
-        <em>
-         string map
-        </em>
-       </span>
-       command is more general in that it maps strings to strings while
-       <span class="emphasis">
-        <em>
-         tr
-        </em>
-       </span>
-       maps characters to characters.
-      </p>
-     </div>
-    </div>
-    <div class="section" title="14.Elementary Regex">
-     <div class="titlepage">
-      <div>
-       <div>
-        <h2 class="title" style="clear: both">
-         <a name="id2950613">
-         </a>
-         14.Elementary Regex
-        </h2>
-       </div>
-      </div>
-     </div>
-     <p id="ch11Section_5_1b1">
-      In computing, regular expressions provide a concise and flexible means for identifying strings of text of interest, such as particular characters, words, or patterns of characters. A regular expression (often shortened to regex or regexp) is written in a formal language that can be interpreted by a regular expression processor, a program that either serves as a parser generator or examines text and identifies parts that match the provided specification.
-     </p>
-     <p id="ch11Section_5_1b2">
-      Regular expressions are used by many text editors, utilities, and programming languages to search and manipulate text based on patterns. For example, Perl, Ruby and Tcl have a powerful regular expression engine built directly into their syntax. Several utilities provided by Unix distributionsincluding the editor
-      <span class="emphasis">
-       <em>
-        ed
-       </em>
-      </span>
-      and the filter
-      <span class="emphasis">
-       <em>
-        grep
-       </em>
-      </span>
-      were the first to popularize the concept of regular expressions.
-     </p>
-     <p id="ch11Section_5_1b3">
-      Traditional Unix regular expression syntax followed common conventions but often differed from tool to tool. The IEEE POSIX
-      <span class="emphasis">
-       <em>
-        Basic Regular Expressions
-       </em>
-      </span>
-      (BRE) standard (released alongside an alternative flavor called Extended Regular Expressions or ERE) was designed mostly for backward compatibility with the traditional (Simple Regular Expression) syntax but provided a common standard which has since been adopted as the default syntax of many Unix regular expression tools, though there is often some variation or additional features. Many such tools also provide support for ERE syntax with command line arguments.
-     </p>
-     <p id="ch11Section_5_1b4">
-      In the BRE syntax, most characters are treated as literals  they match only themselves (i.e., a matches "a"). The exceptions, listed below, are called metacharacters or metasequences.
-     </p>
-     <table summary="Elementary Regex" border="1">
-      <colgroup>
-       <col width="13">
-       </col>
-       <col width="60">
-       </col>
-      </colgroup>
-     </table>
-     <div class="section" title="14.1.Lazy quantification">
-      <div class="titlepage">
-       <div>
-        <div>
-         <h3 class="title">
-          <a name="id2950823">
-          </a>
-          14.1.Lazy quantification
-         </h3>
-        </div>
-       </div>
-      </div>
-      <p id="ch11Section_5_1c9">
-       The standard quantifiers in regular expressions are greedy, meaning they match as much as they can, only giving back as necessary to match the remainder of the regex. For example, someone new to regexes wishing to find the first instance of an item between &lt; and &gt; symbols in this example:
-      </p>
-      <pre class="programlisting">
-       Another whale explosion occurred on &lt;January 26&gt;, &lt;2004&gt;.
-      </pre>
-      <p id="ch11Section_5_1ca">
-       ...would likely come up with the pattern &lt;.*&gt;, or similar. However, this pattern will actually return "&lt;January 26&gt;, &lt;2004&gt;" instead of the "&lt;January 26&gt;" which might be expected, because the * quantifier is greedy  it will consume as many characters as possible from the input, and "January 26&gt;, &lt;2004" has more characters than "January 26".
-      </p>
-      <p id="ch11Section_5_1cb">
-       Though this problem can be avoided in a number of ways (e.g., by specifying the text that is not to be matched: &lt;[^&gt;]*&gt;), modern regular expression tools allow a quantifier to be specified as
-       <span class="emphasis">
-        <em>
-         lazy
-        </em>
-       </span>
-       (also known as non-greedy, reluctant, minimal, or ungreedy) by putting a question mark after the quantifier (e.g., &lt;.*?&gt;), or by using a modifier which reverses the greediness of quantifiers (though changing the meaning of the standard quantifiers can be confusing). By using a lazy quantifier, the expression tries the minimal match first. Though in the previous example lazy matching is used to select one of many matching results, in some cases it can also be used to improve performance when greedy matching would require more backtracking.
-      </p>
-     </div>
-    </div>
-    <div class="section" title="15.One Liners">
-     <div class="titlepage">
-      <div>
-       <div>
-        <h2 class="title" style="clear: both">
-         <a name="id2950898">
-         </a>
-         15.One Liners
-        </h2>
-       </div>
-      </div>
-     </div>
-     <p id="ch11Section_5_1cc">
-      A
-      <span class="emphasis">
-       <em>
-        one-liner
-       </em>
-      </span>
-      is textual input to the command-line of an operating system shell that performs some function in just one line of input.
-     </p>
-     <p id="ch11Section_5_1cd">
-      The one liner can be
-     </p>
-     <div class="orderedlist">
-      <ol class="orderedlist" type="1">
-       <li class="listitem">
-        <p id="ch11Section_5_1ce">
-         An expression written in the language of the shell.
-        </p>
-       </li>
-       <li class="listitem">
-        <p id="ch11Section_5_1cf">
-         The invocation of an interpreter together with program source for the interpreter to run.
-        </p>
-       </li>
-       <li class="listitem">
-        <p id="ch11Section_5_1d0">
-         The invocation of a compiler together with source to compile and
-instructions for executing the compiled program.
-        </p>
-       </li>
-      </ol>
-     </div>
-     <p id="ch11Section_5_1d1">
-      Certain dynamic scripting languages such as AWK, sed, and perl have traditionally been adept at expressing one-liners. Specialist shell interpreters such as these Unix shells or the Windows PowerShell, allow for the construction of powerful one-liners.
-     </p>
-     <p id="ch11Section_5_1d2">
-      The use of the phrase one-liner has been widened to also include program-source for any language that does something useful in one line.
-     </p>
-     <p id="ch11Section_5_1d3">
-      The word
-      <span class="emphasis">
-       <em>
-        One-liner
-       </em>
-      </span>
-      has two references in the index of the book
-      <span class="emphasis">
-       <em>
-        The AWK Programming Language
-       </em>
-      </span>
-      (the book is often referred to by the abbreviation TAPL). It explains the programming language AWK, which is part of the Unix operating system. The authors explain the birth of the One-liner paradigm with their daily work on early Unix machines:
-     </p>
-     <pre class="programlisting">
-      The 1977 version had only a few built-in variables and predefined functions. It was designed for writing short programs [...] Our model was that an invocation would be one or two lines long, typed in and used immediately. Defaults were chosen to match this style [...] We, being the authors, knew how the language was supposed to be used, and so we only wrote one-liners.
-     </pre>
-     <p id="ch11Section_5_1d4">
-      Notice that this original definition of a One-liner implies immediate execution of the program without any compilation. So, in a strict sense, only source code for interpreted languages qualifies as a One-liner. But this strict understanding of a One-liner was broadened in 1985 when the IOCCC introduced the category of Best One Liner for C, which is a compiled language.
-     </p>
-     <p id="ch11Section_5_1d5">
-      The TAPL book contains 20 examples of One-liners (A Handful of Useful awk One-Liners) at the end of the book's first chapter.
-     </p>
-     <p id="ch11Section_5_1d6">
-      Here are the first few of them:
-     </p>
-     <div class="orderedlist">
-      <ol class="orderedlist" type="1">
-       <li class="listitem">
-        <p id="ch11Section_5_1d7">
-         Print the total number of input lines:
-        </p>
-        <p id="ch11Section_5_1d8">
-         END { print NR }
-        </p>
-       </li>
-       <li class="listitem">
-        <p id="ch11Section_5_1d9">
-         Print the tenth input line:
-        </p>
-        <p id="ch11Section_5_1da">
-         NR == 10
-        </p>
-       </li>
-       <li class="listitem">
-        <p id="ch11Section_5_1db">
-         Print the last field of every input line:
-        </p>
-        <p id="ch11Section_5_1dc">
-         { print $NF }
-        </p>
-       </li>
-      </ol>
-     </div>
-     <p id="ch11Section_5_1dd">
-      One-liners are also used to show off the differential expressive power of programming languages. Frequently, one-liners are used to demonstrate programming ability. Contests are often held to see who can create the most exceptional one-liner.
-     </p>
-     <p id="ch11Section_5_1de">
-      The following example is a C program (a winning entry in the "Best one-liner" category of the IOCCC, here split to two lines for presentation).:
-     </p>
-     <pre class="programlisting">
-      main(int c,char**v){return!m(v[1],v[2]);}m(char*s,char*t){return
-*t-42?*s?63==*t|*s==*t&amp;&amp;m(s+1,t+1):!*t:m(s,t+1)||*s&amp;&amp;m(s+1,t);}
-     </pre>
-     <p id="ch11Section_5_1df">
-      This one-liner program is a
-      <span class="emphasis">
-       <em>
-        glob pattern matcher
-       </em>
-      </span>
-      . It understands the glob characters '*' meaning 'zero or more characters' and '?' meaning exactly one character, just like most Unix shells.
-     </p>
-     <p id="ch11Section_5_1e0">
-      Run it with two args, the string and the glob pattern. The exit status is 0 (shell true) when the pattern matches, 1 otherwise. The glob pattern must match the whole string, so you may want to use * at the beginning and end of the pattern if you are looking for something in the middle. Examples:
-     </p>
-     <pre class="programlisting">
-      $ prog foo 'f??'; echo $?
-
-$ prog 'best short program' '??st*o**p?*'; echo $?
-     </pre>
-     <p id="ch11Section_5_1e1">
-      Here is a one line shell script to show directories:
-     </p>
-     <pre class="programlisting">
-      $ ls -R | grep ":$" | sed -e 's/:$//' -e 's/[^-][^\/]*\//--/g' -e 's/^/   /' -e 's/-/|/'
-     </pre>
     </div>
    </div>
   </div>