Update shell_cheatsheet.md
authorLynne Williams <williams.lynne99@gmail.com>
Sun, 17 Feb 2013 16:54:03 +0000 (11:54 -0500)
committerW. Trevor King <wking@tremily.us>
Wed, 23 Oct 2013 22:27:29 +0000 (15:27 -0700)
shell_cheatsheet.md

index d3671a43227f0d80e1eeb871ece7ff2450c3b8fa..36fcc1636d91d98d4f2f276e8eb956a1b2e3b108 100644 (file)
@@ -116,17 +116,42 @@ where,
     .
     list[n]=Mark
     
+which is referenced in the loop by:
+
+    for varname in ${list[@]}
+    do
+        command 1
+        command 2
+    done
+
+
 _Note:_ Bash is zero indexed, so counting always starts at `0`, not `1`.
     
 
 ### b) While Loop
     
-* **`while`** -->
-    `count=0   
-     while ${count} -lte 6
-     do
-       COMMAND HERE
-     done`
+    COUNTER=0
+    while [  ${COUNTER} -lt 10 ]; do
+        command 1
+        command 2
+        COUNTER=`expr ${COUNTER} + 1` 
+    done
+
+where
+
+
+
+#### b.1) Conditional operators
+
+| Operator | Definition               |  
+|----------|--------------------------|  
+| `-eq`    | is equal to              |  
+| `-ne`    | is not equal to          |  
+| `-gt`    | greater than             |
+| `-ge`    | greater than or equal to |
+| `-lt`    | less than                |
+| `-le`    | less than or equal to    |
+
 
 ### b) That the loop variable takes on a different value each time through the loop...
 ### c) The difference between a variable's name and its value...