From: Lynne Williams Date: Sun, 17 Feb 2013 16:44:38 +0000 (-0500) Subject: Update shell_cheatsheet.md X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;ds=sidebyside;h=207df7ddac24810c43e213693fdb1675315759f4;p=swc-modular-shell-hello.git Update shell_cheatsheet.md --- diff --git a/shell_cheatsheet.md b/shell_cheatsheet.md index 2b1e78c..d3671a4 100644 --- a/shell_cheatsheet.md +++ b/shell_cheatsheet.md @@ -89,22 +89,10 @@ A special kind of redirection is called a pipe and is denoted by `|`. changes all the instances of the word `markdown` to `software` in the first 5 `*.md` files in your current directory. -## 4. Variables -### a) Assignment -* **`varname=1`** --> - -### b) Indexing -* **`varname[0]`** --> _Note:_ the shell is zero indexed. That means you always start counting from zero - -### c) Referencing -* **`${varname}` --> -* **`${varname[@]` --> - -## 5. Loops -NEED TO DO VARIABLE ASSIGNMENT FIRST!!!! -### a) How to repeat operations using a loop... +## 4. How to repeat operations using a loop... +### a) For loop for varname in list do @@ -128,17 +116,10 @@ where, . list[n]=Mark - +_Note:_ Bash is zero indexed, so counting always starts at `0`, not `1`. -* - - -* **`for`** --> - `for filename in *.dat - do - mv ${filename} ${newname} - done` +### b) While Loop * **`while`** --> `count=0